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.
2 Comments
Stuart Wilson
5/11/2020 10:19:29 am
What about reciprocally closing loops? For instance, the user event loop can send a message to other loops in the VI to close, but how do the other loops close the user event loop?
Reply
Craig Bedward
5/11/2020 01:37:07 pm
Other event cases can also set the stop flag to true; the close is not required to go through the Panel Close? case. The coordinated stopping of multiple loops can be challenging, especially when a number of loops are involved. That is one of the things that is handled automatically with our ALOHA and MLA system.
Reply
Leave a Reply. |
Categories
All
|