I have a mainform (frmMain) with a pagecontrol. The pagecontrol is populated at startup by several forms, let us say Form1, Form2, and Form3
procedure TForm1.FormCreate(Sender: TObject);
begin
ManualDock(frmMain.PageControl1);
show;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
ManualDock(frmMain.PageControl1);
show;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
ManualDock(frmMain.PageControl1);
show;
end;
That works great. When I then change activepage, I want the OnActivate method called on the form corresponding to the activepage, so I tried this;
procedure TfrmMain.PageControl1Change(Sender: TObject);
begin
with pagecontrol1 do
begin
lbHeading.Caption := activepage.Caption;
with tform(activepage) do // <= This does
if assigned(onactivate) then // <= not
onactivate(self); // <= work
end;
end;
Activepage is of type TTabsheet