Archived:How to Stop a LabVIEW NXG Application When Closing the Application Window?

Updated Apr 21, 2023

NI does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Environment

Software

  • LabVIEW NXG

I have a stop button in my application, and when I click it, the application stops. However, I would like to be able to stop the application when I close the application window. I have tried to do this, but when I check on the tasks performed by my computer, the application is still running. How can I make sure that my application stops once I hit the close button of my application window?

To be able to stop your application, you can include an Event Filter Node to include this functionality. To include this node, you can follow the next steps:
  1. Create an Event Structure in the Diagram Panel.
  2. Click on the Event Structure Case, and select Window as the event source. After you select the Window event source, another section titled Window will appear below the event sources.
  3. Under the Window section, click on the Event Type dropdown and select Filter Events >> Close >> Close?
The image below displays the steps followed above. 



After selecting this Event Type, the Event Case Structure will show a Filter Event Node, as noted in the image below.


To add the functionality of closing the application when clicking the Close button, you can implement the following example. 

Additional Information

If you wish to include a warning message to have the option to continue executing the application in the background or not, you can implement the Continue Background Execution Warning dialog box. This dialog box will look as the following image shows. 



To include this dialog box, make sure the Background execution warning option is selected when builidng the application.