d.bernaert Posted November 29, 2020 Share Posted November 29, 2020 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 More sharing options...
x11 Posted November 29, 2020 Share Posted November 29, 2020 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 More sharing options...
x11 Posted November 29, 2020 Share Posted November 29, 2020 2. In *.dpr add line ReportMemoryLeaksOnShutdown := True; befor Application.Initialize; then you will see when closing the application that there are memory leaks Link to comment Share on other sites More sharing options...
d.bernaert Posted November 30, 2020 Author Share Posted November 30, 2020 Thx! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now