LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Quit program using "x" in window

I don't wanna create a quit button to quit my program, instead I would like to use the "close(x)" button in the upper right corner of my GUI. How?
Please advice
0 Kudos
Message 1 of 2
(3,469 Views)
Here's info from the help topic titled "Using Callback Functions to Respond to User Interface Events":
"A top-level panel callback receives the EVENT_CLOSE message callback when the user executes the Close command from the System menu or clicks on the Close button in the upper right corner of the panel title bar."
If you don't want an exit button, create a panel callback for your main panel and in that callback include the following case:
case EVENT_CLOSE:
QuitUserInterface (0);
break;
If you're starting from scratch:
1. Use the UIR Editor to create your main panel.
2. Edit the panel (double-click on a blank spot on the panel), enter a Callback Function name, e.g. MainPanelCallback, and click OK.
3. From the UIR editor menu, goto Code >> Generate >> Al
l Code.
4. Under the Section titled Program Termination, click on the panel callback name, e.g. MainPanelCallback, then click OK. The CASE_EVENT_CLOSE will be automatically generated.
If you already have generated all code but don't have a panel callback, name your callback (step 2 above), then goto Code >> Generate >> Panel Callback. You'll then have to insert the case EVENT_CLOSE manually.
Message 2 of 2
(3,469 Views)