jgcode Posted June 20, 2008 Report Share Posted June 20, 2008 Question: When I close a VI with the Window Close method what actually happens in the background?It seems that the VI front panel closes but the VI is still running even if I handle application close event. It doesn't finish off it code?I did a search so I know for an Executable I get handle this for the top level VI by tweaking the .ini to do a cleaner shutdown.And EyesOnVis talks about execution relative to top level vi in code.CheersJG Quote Link to comment
Francois Normandin Posted June 20, 2008 Report Share Posted June 20, 2008 QUOTE (jgcode @ Jun 19 2008, 01:05 AM) Question: When I close a VI with the Window Close method what actually happens in the background?It seems that the VI front panel closes but the VI is still running even if I handle application close event. It doesn't finish off it code? Hi JG, Are you referring to FP.Close method? If that's so, then it does not terminate the program. It just closes the front panel and leaves it running. The Abort method would work, but that's rather harsh to close a VI this way. For an about box, do you need a while loop? If you take only a user event frame with "Panel Close" as an option, whenever the user clicks on X, it will terminate and return control to your main app. http://lavag.org/old_files/monthly_06_2008/post-10515-1213853246.jpg' target="_blank"> Quote Link to comment
jgcode Posted June 20, 2008 Author Report Share Posted June 20, 2008 QUOTE (normandinf @ Jun 19 2008, 01:30 PM) Hi JG, Are you referring to FP.Close method? If that's so, then it does not terminate the program. It just closes the front panel and leaves it running. The Abort method would work, but that's rather harsh to close a VI this way. For an about box, do you need a while loop? If you take only a user event frame with "Panel Close" as an option, whenever the user clicks on X, it will terminate and return control to your main app. http://lavag.org/old_files/monthly_06_2008/post-10515-1213853246.jpg' target="_blank"> Hi Normandinf! (Damn...Vista looks nice Sweet! - Thats the method I need. Explicitly handling the FP.Close event has solved my problem. If it is not handled it freezes as the FP is closed by the user by the VI keeps running. :beer: Quote Link to comment
Yuri33 Posted June 20, 2008 Report Share Posted June 20, 2008 Even better is to use the "Panel Close?" notification event. Then you can discard the user's panel close request and perform a controlled shutdown of your program, ensuring that you can run any cleanup subVI's that you require. I actually do this for both the "Panel Close?" and "Application Close?" notification events, so that I can always ensure a proper shutdown. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.