LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine with event structure

Well, I don't really want to ignore the close button, I like to have that functionality just like every other window.  I am discarding the panel close event just so I can stop the vi before it gets closed.  Without have that event there it closes the window without stopping the vi.


@altenbach wrote:

OK, now you are discarding the panel close event. As I said, you might just configure the VI to ignore the close button instead. No event needed.


 

0 Kudos
Message 11 of 14
(825 Views)

I will try to explain what Altenbach is trying to tell you.  If you uncheck the "Allow user to close window" checkbox, then you don't need any code to discard the Panel Close event.  You can eliminate the event structure entirely.  The user will not be able to close the window.  Wire a True constant from the Stop state to the loop stop sign.  Then your program will end before the window closes and the user cannot force a window close before the program ends.  It is better to use the VI Properties settings to do this rather than to add code to do the same thing.

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 14
(791 Views)

I understand what you guys are trying to tell me, but I want the user to be able to close the window using the X.  The only way that I know how to handle that is using the event structure. 

0 Kudos
Message 13 of 14
(756 Views)

@secr1973 wrote:

I understand what you guys are trying to tell me, but I want the user to be able to close the window using the X.  The only way that I know how to handle that is using the event structure. 


If you want to allow this, keep the Allow User to close window checkbox checked.  This is default behavior.  You should not have to change anything.  However, this is not a good idea.  What if the user clicks the X while the program is running?  It will abort in the middle of the program.  Memory resources might be hung up.  Power supplies might be left on.  It is always best to do a graceful shutdown and to not let the user abort using the x or the Abort button or even File-Exit.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 14 of 14
(747 Views)