Jump to content

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


Recommended Posts

Posted

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?

Posted

Application form is the easy one. Create and Free works automaticly, just call the name.

 

Free form is more flexible. You can decide when create and free is called and you can have more than one form instance per session.

Posted

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;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...