Jump to content

Check created Application forms


Jaume

Recommended Posts

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.

Link to comment
Share on other sites

  • Administrators

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites


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;

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...