Jump to content

Question about freeing frame on tabsheet pagecontrol


d.bernaert

Recommended Posts

Hello,

I'm creating dynamically tabsheets on a unipagecontrol.

On these tabsheets I host Uniframes that are created together with the tabsheet.

The user can close tabsheets.

My question is the following, when the user closes a tabsheet, the tabsheet is freed. Will the uniframe hosted on the tabsheet also be automatically freed or does this need to be done manually?

Thx,

Dominique

Link to comment
Share on other sites

1. When create a frames, set owner tabsheet.

https://www.thoughtco.com/owner-vs-parent-in-delphi-applications-1058218

Quote

Every Delphi component has an Owner property. The Owner takes care of freeing the owned components when it is being freed.

 

Destroying ParentTab will also destroy the frame:

procedure TfmMain.CreateFrame(ParentTab: TUniTabSheet; UniFrameMyClass: TUniFrameMyClass);
begin
  UniFrame := UniFrameMyClass.Create(ParentTab);// ParentTab will be owner
  UniFrame.Parent := ParentTab;
  UniFrame.Show;
end;

 

Link to comment
Share on other sites

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...