LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to close VI's nicely when Window is closed with "X"?

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.

 

 

-Nate
0 Kudos
Message 1 of 6
(3,065 Views)

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

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 6
(3,062 Views)

And look in the examples that come with LabVIEW. There's one called Event Conditional Stop.

0 Kudos
Message 3 of 6
(3,047 Views)

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.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 6
(3,037 Views)

I did a search for events.

0 Kudos
Message 5 of 6
(3,020 Views)

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

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(3,000 Views)