12-23-2010 10:13 AM
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.
12-28-2010 10:33 AM
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.
01-03-2011 12:09 PM
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.
01-03-2011 12:38 PM
@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.