Jaume Posted February 4, 2015 Posted February 4, 2015 Hi, is there any way to check which Application forms are created to free them? The problem is that when i check this: if Form1 <> nil then Form1.close; The Form1 is always different of nil even if it's not created and then as soon as it makes Form1.close it creates Form1 to be able to close it. Thank you. Quote
mehmet07 Posted February 4, 2015 Posted February 4, 2015 if (UniMainModule.GetFormInstance(tform1, False) <> nil) then Form1.close; 1 Quote
Administrators Farshad Mohajeri Posted February 4, 2015 Administrators Posted February 4, 2015 Hi, is there any way to check which Application forms are created to free them? The problem is that when i check this: if Form1 nil then Form1.close; The Form1 is always different of nil even if it's not created and then as soon as it makes Form1.close it creates Form1 to be able to close it. Thank you. Why do you need to close a Form in code? You must let the uniGUI manage Forms' lifetime. Quote
Jaume Posted February 5, 2015 Author Posted February 5, 2015 Thank you for the answer. I need to close Forms because i want to simulate a desktop as the forum samples. So when I close one application of the desktop i want to free all possible Forms that i won't use anymore. Jaume Quote
maher Posted February 5, 2015 Posted February 5, 2015 procedure TUniMainModule.GoMainMenu; var I:integer; begin // Close all forms but not the mainForm. for I := UniSession.FormsList.Count-1 downto 0 do begin try if(TUniForm(UniSession.FormsList.Items[I]).Name <> 'MainForm') then TUniForm(UniSession.FormsList.Items[I]).Close; finally end; end; Quote
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.