LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i end a sub vi when the close window control is clicked?

Hi,

I have a sub vi that sits in a while loop until a 'Done' button is pressed but sometimes the user clicks on the close window control in the top left of the window (MacOS) instead.

After this has happened I would like control to return to the calling vi but it's as though the sub vi is still waiting for someone to click on the done button and the any user actions in the calling vi are ignored.

How do I wire the close window into my program so as clicking on either it or the Done button will end the sub vi and pass control back to the calling vi?

Thanks,
Dave.
0 Kudos
Message 1 of 3
(2,545 Views)
The "event structure" can capture events for "this VI" that include "panel close". If you are using an event structure to look for the push of the Done button, just add another event that will catch the panel close as well (you can even configure the stucture to not pass on the close event). If you are not using the event structure to watch for the done button, perhaps you should. If you cannot use it in the same loop, you can put it in a parallel loop and use any of several signaling mechanisms to communicate between the loops.
Message 2 of 3
(2,539 Views)
Thanks Warren,

I set up a Close panel event to end the vi and it works fine.

Cheers,
Dave.
0 Kudos
Message 3 of 3
(2,517 Views)