LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vi stop event

hello one and all,

i have a vi that open visa components and i have an exit button on the vi that will exit any loops and gracefully close those visa components and put the respective instruments back in local mode.  if, however, i press the stop button the vi does not gracefully close those visa components, thus making a mess under the VISA resource input.  how do i make sure that certain code is always run when the vi is told to stop or exit regardless of the method of closure?

thank you in advance.

lucas
0 Kudos
Message 1 of 4
(3,708 Views)
The toolbar with the stop and run button should be hidden (VI Porperties>Window Appearance>Customize) and you should be using the event structure to trap the other window close events. There is even a shipping example called Event Conditional Stop. There are application events for Exit and Panel Close.
0 Kudos
Message 2 of 4
(3,700 Views)
ok, well, maybe i have to be more clear.  the vi i designed can be a stand-alone application.  it has an exit button to gracefully exit and close those visa connections.  however, this vi can also be a sub-vi and when the main-vi exits, say by the abort button, i want the sub-vi to absolutely execute the "close visa connections"  code.  i hope that is more to the point.

lucas
0 Kudos
Message 3 of 4
(3,690 Views)
Let me be more clear. You hide the abort button by removing just it or the whole toolbar. If you leave the abort button visible or the windows "x", or the windows "close" unhandled, the main VI stops. Nothing else in the main will run. With the event structure, it is trivial to call the subVI when the user stops the main.
0 Kudos
Message 4 of 4
(3,685 Views)