Jump to content

ApplicationForm and FreeForm - what is the difference and what better?


elGringo

Recommended Posts

For the moment I can understand that difference in calling them

 

To call Application form we should use

SomeApplicationForm.Show();

To call FreeForm we should use

...
var SomeFreeForm:TSomeFreeForm;

begin

    SomeFreeForm:=TSomeFreeForm.Create(UniApplication);
    SomeFreeForm.Show();
...  

// SomeFreeForm.Free; // << somewhere in the code

So - what else different beetwen them?

 

Is ApplicationForm is more modern - with automatical memory management on it?

 

What approach is more reliable from your experience?

Link to comment
Share on other sites

hi oliver.

 

can you upload a sample?

 

I am trying to do the same.

 

thanks.

procedure TfrmMain.OpenFrame(Sender: TObject);
var
  ts: TUniTabSheet;
  fra: TUniFrame;
begin
  ts := TUniTabSheet.Create(self);
  ts.Caption := (Sender as TUniMenuItem).Caption;
  ts.PageControl := PageCtrl;
  // PageCtrl.TabIndex := -1; // Workaround / Issue #1025 / Nicht mehr notwendig ?!
  PageCtrl.ActivePage := ts;
  fra := TFrameClass((Sender as TUniMenuItem).Tag).Create(self); // type TFrameClass = class of TUniFrame;
  ts.Tag := Integer(fra); // call "TComponent(PageCtrl.ActivePage.Tag).Free;" when close TabSheet (ActivePage) later
  fra.Name := fra.Name + IntToStr(Integer(fra)); // to open a frame more than once
  fra.Align := alClient;
  fra.Parent := ts;
end;
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...