LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop vi with parallel loops

I have a vi with many parallel loops. I want to put a button in to close the vi, but before it closes i want to popup a question that says " Are you sure you want to close the program?". If they hit yes the vi will close, if they hit no the popup closes and program remains running. I have attached my main vi to look at but there are too many vi's to include everything. I have tried adding a while loop around everything and stopping that with minimal success. Any help is greatly appreciated.
 
Thanks
Mike
0 Kudos
Message 1 of 2
(2,429 Views)

Ugh!

You did not include your subVIs, but do they all execute fast (below 250ms)? If the answer is yes, you could put all code in one loop since all loops run at the same rate.

Why are all your stop buttons hidden? In principle, you need only one, then put a local variable(read) in each loop.

In one loop, e.g. the topmost loop, replace the wait with an event structure. Add a timeout event set to 500ms and place the code that is currently inside this loop. Add a filtering event for "panel close?" and for "stop-value changed?" In each of these non-timeout events place a dialog with your message, and discard the event if cancel is pressed. If the dialog is accepted, write a true to the stop to stop all loops.

0 Kudos
Message 2 of 2
(2,423 Views)