LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to wire into that close window x button

Solved!
Go to solution

I want when the end user click the program's x red button at the top right, a dialog box with two buttons will pop out and say "are you sure?", if the end user click Ok, the program will shut off and close its window, if the end user click cancel, the program continues to run.

 

So I start building the vi, refer attached, but I was flipping the help search without knowing what is the name of that red x button, and i cant find the function block!Smiley Wink

 

So, my question is:

 

1. I want to wire into that x red close window button event to control my case structure, but where is that function block?

2. Where is the function block that shut off the program as well as close the program window?

 

Thanks.

0 Kudos
Message 1 of 3
(3,689 Views)
Solution
Accepted by sunflower2772
Add an event structure with a Panel Close? event (under <this VI>).  There you can bring up the dialog and have the output wire into the Discard? output.
Message 2 of 3
(3,684 Views)

I would add, by way of explanation, that you don't actually "tie into the button", you tie into the event that it represents.

That means that if you add an event for PANEL CLOSE?, that event gets triggered by all the things that would close the window: Clicking the CLOSE box (as mentioned), but also typing CTRL-W, selecting CLOSE from the FILE menu (if that's available), aborting the program from the TASK MANAGER (ctrl-alt-delete), and script operations on OS X.

 

Usually, that's what you want. The point is you're being asked if it's OK to close and you get a chance to say "no".  But it doesn't necessarily come from the CLOSE box.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 3 of 3
(3,668 Views)