erich.wanker Posted December 15, 2020 Share Posted December 15, 2020 Hi .. basic delphi question .. but i am not sure at this moment: must i "free" sub-components of a component? i create in a loop (while not table.eof do begin..) something like this: object_counter:=object_counter+1; objekt[object_counter] := TUniPanel.Create(self); objekt[object_counter].Parent := UniContainerPanel1; <- the UniContainerPanel is the basic Parent of all "objekt" created Controls objekt_bild[object_counter]:= TUniImage.Create(self); objekt_bild[object_counter].Parent :=objekt[object_counter]; <- the objekt is the parent objekt_text[object_counter]:= TUnilabel.Create(self); objekt_text[object_counter].Parent :=objekt[object_counter] <- the objekt is the parent; objekt_text_1[object_counter]:= TUnilabel.Create(self); objekt_text_1[object_counter].Parent :=objekt[object_counter]; <- the objekt is the parent objekt_text_2[object_counter]:= TUnilabel.Create(self); objekt_text_2[object_counter].Parent :=objekt[object_counter]; <- the objekt is the parent if i write objekt[x].free -> are the objekt_bild, objekt_text, objekt_text_1, objekt_text_2 destroyed automaticaly ???? Quote Link to comment Share on other sites More sharing options...
x11 Posted December 16, 2020 Share Posted December 16, 2020 12 hours ago, erich.wanker said: destroyed automaticaly ???? 12 hours ago, erich.wanker said: TUniImage.Create(self); self - this is a owner. when owner is free then uniimage free too. Your question is not about unigui, your question is about Delphi. Difference between Owner and Parent in Delphi http://theprofessionalspoint.blogspot.com/2014/08/difference-between-owner-and-parent-in.html Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted December 16, 2020 Administrators Share Posted December 16, 2020 There is no need to free components which are created with an owner. Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted December 16, 2020 Author Share Posted December 16, 2020 i create and free a lot of times ... i have anxiety that someting could go wrong Serverside with memory if 1000 users are working with this ?? now i made: objekt[object_counter] := TUniPanel.Create(self); objekt[object_counter].Parent := UniContainerPanel1; objekt_bild[object_counter]:= TUniImage.Create(objekt[object_counter]); <- the owner is now the created TUniPanel objekt_bild[object_counter].Parent :=objekt[object_counter]; if i write objekt[x].free -> everything what is created for this control should be set free - or ? ice_video_20201216-085805.webm Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.