Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Confused References
Tue, Aug 18 2015 4:25 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

I think I'm confusing myself, but ...

I have a form (Form2) that contains a pagepanel.
I add a new page to this pagepanel.
I then create a new form (frmClients) and make its parent the pagepanel page so it's contained within the pagepanel page.

This all works fine.

Now I want frmClients to be able to create a new page in the pagepanel on Form2. The problem is, how do I reference the page panel? I can't "use" the Form2 unit inside frmClients as that will create a circular reference, but the compiler fails when I try to make reference to the pagepanel (understandably).

Something to do with parents and parentpagepanel but struggling...
Tue, Aug 18 2015 4:27 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

AHHH. GOT IT.

Ignore the stupid var names (just a test unit), but this works.

procedure TfrmClient.TBBEditClick(Sender: TObject);
var
  pp: TPagePanel;
  ppp: TPage;
begin         
  ppp:=TPage(Self.Parent);
  ppp.ParentPagePanel.NewPage;
end;
Image