09-29-2010 02:17 PM
Hi All,
Is there a way I can configure my VI to shut down in a controlled manner if the user clicks the little red "X" at the very top right of the LabVIEW program window (see attached jpg).
I would like to set my program up to shut down the com port and exit normally if someone clicks that button.
Any help would be greatly appreciated.
Thanks!
09-29-2010 02:20 PM
09-29-2010 02:21 PM
Use an event structure with an event configure to catch the...
<This VI> Panel Close
event.
Ben
09-29-2010 02:31 PM
Remember to wire a True to the discard event node, otherwise the VI will close anyway before you've had an chance to let any of your shutdown code do its work.
09-29-2010 02:55 PM
More specifically, you should use the "panel close?" filtering event (note the question mark).
With this you can discard the event and do whatever is more appropriate for the shutdown instead.
09-29-2010 03:05 PM
Be aware that the Panel Close? event will capture the littel red X, but it will not capture the File - Exit or Ctrl-Q event. To capture this, you need another event case for Application Instance Close? event. Similary, you can wire a True to the Discard terminal to stop the closing.
09-30-2010 03:05 PM
Thanks very much, all. I will work on implimenting the event control ASAP.