LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Executable won't shut down when VI Front Panel is hidden

Solved!
Go to solution

When my code finishes running, I close the user interface by using the "FP.Open" method with state "Hidden" and then stop the VI by sending a stop command on a queue. This works fine in development mode, but when I build an exe, the icon remains on the task bar.

 

If I don't hide the FP before stopping the VI, then it stops normally, you just have to click on the window again to close it after it stops running. I tried using the "FP.Close" method, but that caused problems elsewhere in the code. I hope to gain insight on why this is happening. Thank you

0 Kudos
Message 1 of 8
(4,664 Views)

So I've always used the Front Panel Close? filter event, then discard it, and run my clean up which will usually set the window to hidden, and then if I'm in the run-time engine (conditional disable structure) run the Quit LabVIEW primitive, or in some extreme cases perform a taskkill on the application name.  Not sure what is necessary I just haven't had a problem with this process.

Message 2 of 8
(4,639 Views)

Stopping a hidden panel does the same as stopping a visible panel.  You just can't see the panel anymore.  You can still use the FP.Close, just make sure it is the last thing done after all other processes.

Message 3 of 8
(4,633 Views)

I think you just have to catch the panel close event, discard it, then exit the VI as you normally would.  In dev mode, this should return you to edit mode; in an executable, it should close the front panel and exit.

 

edit:

If the VI is specifically set up to close the front panel after executing, which is the default behavior.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 8
(4,630 Views)

Thank you all for your comments.

 

As suggested, I do discard the panel close event, then shut down and close (or hide) front panels in my desired sequence. If I use the "FP.Close" method instead of "FP.Open" -> Hidden, then the executable does indeed terminate. It requires an extra message handling case in my architecture, which I was trying to avoid, but it's not a big deal 🙂

0 Kudos
Message 5 of 8
(4,610 Views)

I'm not familiar with your architecture, but I usually just execute it outside of my main loop (or merge errors from parallel loops)

 

like so...

tmp

0 Kudos
Message 6 of 8
(4,589 Views)
Solution
Accepted by topic author Gregory

Hidden panels are still in memory.  Therefore your executable does not shut down.  If you close the front panel, then the RTE will shut down.  No need for the Quit LabVIEW function.  The caveat I have found is that you need to make sure the FP.Close is the very last thing that happens, meaning all of your modules/actors have to be stopped.  The reason is that if all of the panels are closed and there is still code to be ran, that code will not be ran (burned by this many times this last year).

 

Oh, and I always use the FP.Close inside of a Conditional Diagram Disable structure (RunTime Engine==True) so that the panel is not closed during development.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 8
(4,562 Views)

@crossrulz wrote:

Hidden panels are still in memory.  Therefore your executable does not shut down.  If you close the front panel, then the RTE will shut down.  No need for the Quit LabVIEW function.  The caveat I have found is that you need to make sure the FP.Close is the very last thing that happens, meaning all of your modules/actors have to be stopped.  The reason is that if all of the panels are closed and there is still code to be ran, that code will not be ran (burned by this many times this last year).

 


Yes, this is exactly the the reason that I was making the window hidden instead of closing it. Thanks so much for clearing that up!

0 Kudos
Message 8 of 8
(4,554 Views)