11-28-2012 06:00 PM
Hi Adam, thank you for your advise. I followed your suggestion and found this code
It is working in my program if I place an "exit" button in front panel. But what exactly I want is to achieve "Click X on the top right side" to close front panel. Do you know how can I do that? Currently if I click this "X", the front panel stays there but all the buttons cannot work.
11-29-2012 02:17 AM
hi
attached is a simple code explaining how you can close the module.
11-29-2012 11:22 PM
Thank you! I have solved it!
11-29-2012 11:38 PM
@adambe wrote:
Assuming you already have an event structure for GUI inputs....
1. Create a new event: <This VI> -> Panel Close?
2. Wire a true to Discard?
3. *Execute the code that is being run on a GUI Stop button command.*
4. Use (This VI) invoke node Front Panel.Close to close the vi after execution completes.
If you don't mind your VI running in the background until it finishes closing up shop, you can skip steps 2 and 4.
Without seeing your code, it will be difficult to give you more help other than these generalizations.
NO. You can't skip step 2. The Red X is like hitting the abort button on your VI. It kills the process and keeps the code you want to run in step 3 from ever running.
See http://forums.ni.com/t5/LabVIEW/executable-process-persist-after-X-closing-window/td-p/1803056 for more information on the Red X Panel Close? event.