LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 06/22/2009


JB wrote:

How do you close your sub-VIs ? Also by the X in the upper corner ?


Once you kill the main VI, any open subVIs will disappear automatically.

Message 21 of 31
(3,025 Views)

I built a simple project with a Main VI (where the toolbar is hidden) that calls a SubVI (where the panel is shown when loaded).  There are 4 permutations of the EXE:  Close FP, Close FP and Quit LV, Hide FP and Quit LV, and Quit LV.

 

Darren-

I don't see a blink with "Quit LV".  But, this is a simple demo, so maybe I'm missing something.

"Close FP and Quit LV" doesn't always close the SubVI panel -- the Quit LV code at the end seems to run intermittently.

 

Christian-

"Close FP" doesn't close the SubVI panel.

 

All-

"Hide FP and Quit LV" runs consistenly.  This could be especially helpful if you're using a plug-in architecture (where subVIs are loaded from outside the EXE), where you're not sure which VIs (and their loading settings) will be used in the future.

 

 

Close FP

Close FP

 

 

Close FP and Quit LV

Close FP and Quit LV

 

 

Hide FP and Quit LV

Hide FP and Quit LV

 

 

Quit LV

Quit LV

 


 

Message Edited by LabBEAN on 06-25-2009 09:54 AM

Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
Message 22 of 31
(2,993 Views)

On a Mac users quit the program from the menu or by cmd-Q.  Clicking on the red X button (in the upper right corner) closes the window but may not quit the application.

 

I have not built an application recently in LV, so I cannot comment on the behavior of that specifically.  If built applications run like most Mac apps, closing the window as Altenbach suggested would leave the application running with a title bar showing but no window.

 

If I get some time later I may try it to see what happens.

 

Lynn 

0 Kudos
Message 23 of 31
(2,983 Views)

LabBEAN wrote:

Darren-

I don't see a blink with "Quit LV".  But, this is a simple demo, so maybe I'm missing something.

"Close FP and Quit LV" doesn't always close the SubVI panel -- the Quit LV code at the end seems to run intermittently.


Are you showing the SubVI panel with the "Show Front Panel When Opened" option, or maybe one of the SubVI Node Setup options?  If so, I could envision some synchronization issues...in that case, I guess the Hide FP trick might be a better approach.

 

As for the toolbar flicker, I was only able to reproduce it when I had an EXE with a fairly-sized hierarchy, so that's probably why you didn't see it.

0 Kudos
Message 24 of 31
(2,963 Views)

Darren wrote:

As for the toolbar flicker, I was only able to reproduce it when I had an EXE with a fairly-sized hierarchy, so that's probably why you didn't see it.


Well, I've never seen the issue, so maybe my hierarchies are simply not big enough. 🙂

 

Still, isn't that something that should be handled automatically and internally. Maybe LabVIEW should do the shutdown steps in a more "eye pleasing" order by itself and hide the window automatically while doing the rest of the shutdown?

0 Kudos
Message 25 of 31
(2,952 Views)

 


Darren wrote:

 

Are you showing the SubVI panel with the "Show Front Panel When Opened" option, or maybe one of the SubVI Node Setup options?

 



VI Properties >> Window Appearance >> Customize >> Show front panel when loaded = True

 

 

I guess the broader question here is:  Does code continue to run when you invoke FP.Close on the Main VI?  This nugget assumes "yes", but in practice it looks more like "for a really short time" (since code after the FP.Close sometimes executes and sometimes doesn't).  I attached the example project, VIs, and EXEs with my last post.

 


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 26 of 31
(2,945 Views)

LabBEAN wrote:

I guess the broader question here is:  Does code continue to run when you invoke FP.Close on the Main VI?  This nugget assumes "yes", but in practice it looks more like "for a really short time" (since code after the FP.Close sometimes executes and sometimes doesn't).

 


I think the correct answer is "until everything has been cleaned up".  The Close.FP suggested in the nugget is intended to give the user a clean window close without flicker.  The Exit LabVIEW is intended to get rid of the EXE app instance in case you've opened a bunch of references to stuff and haven't cleaned them up.  

0 Kudos
Message 27 of 31
(2,941 Views)

Darren said:

I think the correct answer is "until everything has been cleaned up".


 

 

The "Close FP and Quit LV" EXE (diagram above) closes the subVI panel intermittently.  So, the Quit LabVIEW primitive at the end of that diagram seems to run sometimes and not others.  Practically speaking, it doesn't look like you can count on any code running after the FP.Close method.  Correct?  If you think your original post (similar to the "Close FP and Quit LV" EXE) is still appropriate, could you elaborate on your comment?  Thanks Darren.


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 28 of 31
(2,922 Views)

LabBEAN wrote:

 

The "Close FP and Quit LV" EXE (diagram above) closes the subVI panel intermittently.  So, the Quit LabVIEW primitive at the end of that diagram seems to run sometimes and not others.  Practically speaking, it doesn't look like you can count on any code running after the FP.Close method.  Correct?  If you think your original post (similar to the "Close FP and Quit LV" EXE) is still appropriate, could you elaborate on your comment?  Thanks Darren.


When I have an app that spawns the panels of other VIs, I always open those panels programmatically...I never use the "Show Front Panel When Called" option, as you did with your example.  So in your case, I believe you'll need to take another approach, like the "Hide FP" approach that was described earlier.  But for those apps where child VIs are launched (and closed) programatically, I believe my suggestion is still appropriate.

0 Kudos
Message 29 of 31
(2,919 Views)

 


Darren said:

 

When I have an app that spawns the panels of other VIs, I always open those panels programmatically...I never use the "Show Front Panel When Called" option, as you did with your example. 



To clarify, I was using "Show front panel when loaded" (not "when called") to demonstrate the problem with calling "Quit LabVIEW" after an FP.Close method.  But, to check your hypothesis, I added another EXE permutation to show the subVI front panel programmatically at the beginning and then exit by FP.Close and "Quit LabVIEW".  As seen previously, the "Quit LabVIEW" primitive runs intermittently (sometimes and not others).  This can be demonstrated by running the "Test Close FP and Quit LV - Launch Add SubVI" EXE and clicking the Stop button.  Sometimes "Quit LabVIEW" runs and closes both panels.  Other times it doesn't run, and the subVI panel remains open.

 

If you still stand behind your original post, maybe you could attach an example?  Otherwise, it looks like FP.Close is sufficient without the "Quit LabVIEW" OR a developer should use FP.Open (Hide) with the "Quit LabVIEW".

 

Test Close FP and Quit LV - Launch Add SubVI

Test Close FP and Quit LV - Launch Add SubVI


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 30 of 31
(2,848 Views)