Jump to content

Recommended Posts

Posted

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.

  • Administrators
Posted

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.

Posted

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

Posted


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;

 

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