Jump to content

HowTo: Close all active forms


mierlp

Recommended Posts

  • 1 month later...

You can to somenthing like this

 

for I := 0 to UniApplication.UniSession.FormsList.Count-1 do Begin
  if TUniForm(UniApplication.UniSession.FormsList.Items).ClassType<>TMainForm then //TMainForm Is the class of the form that you dont want to close
    TUniForm(UniApplication.UniSession.FormsList.Items).Close;
End;
 

Link to comment
Share on other sites

  • 2 weeks later...

You can to somenthing like this

 

for I := 0 to UniApplication.UniSession.FormsList.Count-1 do Begin

  if TUniForm(UniApplication.UniSession.FormsList.Items).ClassType<>TMainForm then //TMainForm Is the class of the form that you dont want to close

    TUniForm(UniApplication.UniSession.FormsList.Items).Close;

End;

 

 

Hi tnt23,

once I tried something like that, but I found it a little dangerous: it may have a strange behaviour when exceptions are thrown. On the other hand, it surely is the simplest way to achieve what mierlp is asking for.

Link to comment
Share on other sites

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