Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Avoiding Circular References
Sat, Aug 15 2015 10:51 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

I have a main form which loads other forms into pagepanel pages as required.
If I want one of these "sub" forms to delete all of the pages in a page panel, how can I do that?

So, in my main unit I have this -

     PagePanel1.NewPage;
     PagePanel1.LastPage.Tab.Caption:=tabName;
     PagePanel1.LastPage.Tab.AllowClose:=true;
     PagePanel1.ActivePage:=PagePanel1.LastPage;
     tempInstance:=theForm.Create(nil);
     tempInstance.Parent:=PagePanel1.ActivePage;
     tempInstance.Show;

This new form can decide to force a new login if no active session is reported by the server (AJAX requests made on this "sub"  form). When this log in is forced, I want to remove all the page panel's pages. The only way I can think of to do this is to create a public proc on the main unit which walks through each page and removes it.

Problem is, I can't reference a proc (or anything else) on the main unit from this sub unit because I need to "use" the main unit, and I can't do this because it creates a circular reference between the main and sub units.

I see the paradox that I would be calling a function from a unit that would be deleted by the function, but I can't see how to achieve what I want.

Alternatively, because I force a login on app start, a way to just "restart" the app would probably suffice.

Thoughts gratefully received.
Sat, Aug 15 2015 12:08 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

Ah, ignore me.
I'll find a different way to layout the app. It was not as good an idea as it first seemed anyway...
Image