From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Panel close? event.

I loaded "b.vi" by asynchronous way from a_asynch.vi [load] button then stop "b.vi" by pressing the [quit] button.
In this case, b.vi can loaded again in a_asynch.vi.

 

But if I press panel close ("X") in stopping b.vi, b.vi cannot be loaded again in a_asynch.vi.
Of course, This can be solved by stopping the while loop of b.vi (adding <This VI> - Panel Close?).

 

I confused a little bit because I have never added Panel Close? to my event structure usually.
Is it one of special things I have to take care in programming open VI reference?

labmaster.

 

Download All
0 Kudos
Message 1 of 3
(1,309 Views)
  • You don't need any references. The Vi knowns it's own reference.
  • You can use a plain "panel close" (notify event) event if you want to unconditionally stop the VI. You only need a "panel close?" (filter event!) event if you potentially want to discard the click on the [x].
  • Not sure why you use such a strange mechanical action for the quit button. Latch action is preferred.
  • Closing a panel of a subVI does not stop the subVI. It just closes the panel. If you stop the loop using a panel close event, your subVI will stop, same as with the quit button.

 

0 Kudos
Message 2 of 3
(1,296 Views)

See if something like this works for you:

 

altenbach_0-1653659980611.png

 

Now you can even delete the "quit" control and have everybody use the [X] to kill the VI as any windows users already knows. 😄

 

(That's what I use. My programs typically don't have stop/quit, etc. buttons! If cleanup code is needed, use a "panel close?" event, discard it, and initialize the proper shutdown procedure.)

Message 3 of 3
(1,291 Views)