LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI start/end events?

Solved!
Go to solution
I have an application in which i need to execute some events when the main vi is open/closed (closed as in the user clicks the top right corner 'x'). Is there any event i can use for this? 
Message Edited by Gordal on 05-18-2010 03:05 PM
0 Kudos
Message 1 of 6
(3,222 Views)
Solution
Accepted by topic author Gordal

You would use the <Application> Application Instance Close? and/or the <This VI> Panel Close? filter events.

 

Jim Kring has a nice blog entry on this subject:

 

Controlling the Exit of Built Applications

 

Message 2 of 6
(3,212 Views)
Are there similar ways to do this in non-built applications? When developing.
0 Kudos
Message 3 of 6
(3,200 Views)

Gordal wrote:
Are there similar ways to do this in non-built applications? When developing.

 

Yes.  Select <This VI> instead of <Application> when adding a new event.  Some sub-selections for This VI are:  Key, Mouse, Menu, Panel Close, Panel Resize.  Select Panel Close to capture when someone clicks on the X in the upper right corner of the front panel.  You can use Panel Close? to trap the event and wire a True to the discard terminal to prevent the user from closing the panel with the X.

 

 

You can also use <Application> - Application Instance Close? to trap when a user clicks on File - Exit.

 

Message Edited by tbob on 05-18-2010 01:55 PM
- tbob

Inventor of the WORM Global
Message 4 of 6
(3,187 Views)

Does it have to be event based?

it coulb be as simple as a state machine architecture

Startup State->Main Code->Shutdown State

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 6
(3,147 Views)

falkpl wrote:

Does it have to be event based?

it coulb be as simple as a state machine architecture

Startup State->Main Code->Shutdown State


Based on the original poster's question, yes.

 


 (closed as in the user clicks the top right corner 'x').


A state machine by itself can't capture events such as the application close, you need to use the event structure.
0 Kudos
Message 6 of 6
(3,115 Views)