LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

X Control Exec State Change with Panel Close

I have an X Control that launches VIs dynamically and loads them into subpanels. If I put this X Control on a VI front panel and that VI has its panel closed, but that panel close event is unhandled so LabVIEW takes the default panel close behavior, the exec state change never fires. If I reopen the VI however, it is stopped. Because of this, my shutdown user event which is sent in the Exec State Change event case never sends and my VI is left running in the background. 

  

Of course, I know the panel event should be handled, but this is about robustness of my X Control, not the panel close event handling. Is there any way I can capture this specific case?

0 Kudos
Message 1 of 5
(3,177 Views)

Hi Greg,

 

To better assist you in troubleshooting this, could you please provide your code and some screenshots of the behavior you are encountering?

 

Thanks,

 

Devon R.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 5
(3,114 Views)

See attached. Notice when you open Example.vi and run it, you get a popup that the Exec State change fired. When you press the stop button, you get that pop up as well. If you hit abort, you get the popup. 

 

Now, instead of doing all of the above, run and then just close the panel of Example.vi; You get no popup.

0 Kudos
Message 3 of 5
(3,104 Views)

Hi,

 

Thanks for sending in the code.  Have you tried implementing an event structure?  With an event structure, you can set the event to, “Application Instance Close”, so that you can execute some code when a user executes the Quit LabVIEW function.  Please see attached screenshots.

 

Devon R.

Applications Engineer

National Instruments

 

1.PNG

2.PNG

0 Kudos
Message 4 of 5
(3,048 Views)

@DevonR wrote:

Hi,

 

Thanks for sending in the code.  Have you tried implementing an event structure?  With an event structure, you can set the event to, “Application Instance Close”, so that you can execute some code when a user executes the Quit LabVIEW function.  Please see attached screenshots.

 

Devon R.

Applications Engineer

National Instruments

 

1.PNG

2.PNG


This doesn't work because if you close an owning project but not LabVIEW, the refnum goes invalid. However, I got an answer from here that lets me know what I needed to.

0 Kudos
Message 5 of 5
(3,023 Views)