FlexSim Community Forum

FlexSim Community Forum (https://archive.flexsim.com/index.php)
-   Q&A (https://archive.flexsim.com/forumdisplay.php?f=66)
-   -   Closing GUI Windows correctly (https://archive.flexsim.com/showthread.php?t=2040)

Stephan Seidel 02-09-2012 04:14 AM

Closing GUI Windows correctly
 
Hi all,

I've created my own Model Control GUI and I open from that GUI via the OnPress Trigger of an button another GUI:

createview("MAIN:/project/model/Tools/GUIs/Testing GUI");

In that new GUI I've got a button which is supposed to close the new GUI. The code is:

closeview(ownerview(c));

The window is closed, everything appears to work well. But when I save and reopen the model all the small "Testing GUI" windows that I've ever opened and closed afterwards are open again. I can close them again and you can believe me, it takes ages to close 50 or so windows.

So here are my questions:
  1. What should the code for such a Close button look like? closeview is apparently not correct.
  2. How can I prevent the model from reopening all the windows from the past? Where is the information stored that these windows have to be reopened?

I'm also afraid there is nothing in the Documentation about that particular issue.
So thanks for any help.

Stephan

Stephan Seidel 02-09-2012 04:38 AM

Quote:

Originally Posted by Stephan Seidel (Post 9433)
2. How can I prevent the model from reopening all the windows from the past? Where is the information stored that these windows have to be reopened?

For the closing part I've found a very simple solution. I just had to click the close [x] button in the upper right corner of the window. If I close every window this way they wont reopen on reloading the model. Now the remaining question is:
What code is behind the little [x]?

Carsten Seehafer 02-09-2012 04:59 AM

Quote:

The view is not removed from the active views folder, however. Use destroyobject() to remove it.
This is from the documentation of closeview(). You have to add destroyobject() ;)


Greetings

Carsten


P.S.: The "x" is from windows and not flexsim code.

Stephan Seidel 02-09-2012 05:10 AM

Closing a custom GUI per button
 
Many thanks, Carsten. Especially for pointing out the documentation on closeview. Apparently I was so disappointed by it, that I didnt even bother to look.

Just to post the complete code it in case someone is looking for it:

Code:

closeview(ownerview(c));
destroyobject(ownerview(c));

Cheers,
Stephan


All times are GMT -6. The time now is 10:45 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.