Most LabVIEW apps have a tell-tale “Stop” or “Done” button. That always bugs me. Why shouldn’t a LabVIEW program end the same way any other Windows program ends?
They should. Here’s how to close your program the right way.
In order to catch the press of the Close button, you need to use an event structure. The event structure allows you to tie into the Panel Close? event to make it run your code.
You will find the event under <This VI>Event Source. Take note of the question mark in the event name. There is also an event called Panel Close. You need the one with the question mark. It is a filter event. Since it is a filter event, it is indicated with a red arrow.
Filter events get called before the event is processed. By wiring a TRUE to the discard, the event is stopped, so the standard event handling is not processed. We have complete control over what we want to do in response to the event.
Now you have no excuse. So, please, no more “Stop” buttons.
8227 44th Ave W, Suite F
Mukilteo, WA 98275