08-24-2010 03:06 PM
Is there a way to close VI's nicely when Window is closed with "X"?
The VI is the GUI for an automated test console and I would like to save a state when it is closed to allow for the user to reopen the VI and the GUI is the same. At the very least I would like to make sure the equipment is placed into a safe state.
08-24-2010 03:11 PM
There is, but nothing particularly simple. The first part is using an event structure in your UI to detect the operator clicking on the "X". That can then be filtered to allow you to run other code to save the states, whatever before actually closing the program. I also usually include a pop up message window "Do you really want ..."
08-24-2010 03:22 PM
And look in the examples that come with LabVIEW. There's one called Event Conditional Stop.
08-24-2010 03:33 PM
Dennis, I could not find the VI you mentioned. How do you search on a vi's name in Labview? I even tried with Windows Explorer search and didn't find it.
What I did find was that you need to use the "Panel Close?" filter event to catch clicking on the X, and the "Application Instance Close?" filter event to catch clicking on the menu bar File - Exit. The attached vi does just this.
08-24-2010 03:54 PM
I did a search for events.
08-24-2010 04:57 PM - edited 08-24-2010 04:59 PM
@Dennis Knutson wrote:
I did a search for events.
I did that too the first time. Must have just missed the vi because now I see it. Thanx.
That vi does the same thing I did in mine, filter event for Panel Close and one for Application Instance Close.