LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to close a subvi programmatically

I am calling a subvi in my main application.  The front panel opens because I checked the box in VI Properties > Windows Appearance > Show Front Panel When Called.  How can I close it prgrammatically at a time when I want it to dissapear?  BTY, I am using LV 6.1.
 
Thanks,
 
Jerome.
0 Kudos
Message 1 of 19
(10,259 Views)
There are a few ways of doing that, but first answer yourself this question: should the subvi keep running or finish executing?
If you can have it finish its job, it will or can close by itself (eihter choose dialog style window or check option "close front panel if originally closed").
If the subvi is to keep running, you can hide or minimize its window by using vi server and writing to a front panel state property node. Make sure you save your work often when working with this!

0 Kudos
Message 2 of 19
(10,251 Views)

Aart-Jan, thanks for your help.  I prefer the vi to close, but if I could get the front panel to dissapear, that would be great already.  I don't want to check the box "close front panel if originally closed", because I am calling the subvi many times and I want to close it after it has been called many times not necessarily related to its end of execution.

I couldn't find a property node option that would allow me to hide or minimize the window.  What I did it opening a vi reference then connect it to a property node.  What am I missing?

Thanks,
 
Jerome.
0 Kudos
Message 3 of 19
(10,246 Views)
Try the attached VIs.
 
The Main VI calls/ closes the sub VI by VI Server.
 
LabVIEW 7.0
Windows set at 1024x768
 
Regards,
 
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 4 of 19
(10,240 Views)
maybe this helps:


0 Kudos
Message 5 of 19
(10,235 Views)

Aart-Jan,

Thanks for your help.  I couldn't find the property of FP.State (probably because I am still using LV 6.1) but I tried FP.open and it works fine.  Thanks again for your help.

Jerome.

0 Kudos
Message 6 of 19
(10,203 Views)

Hello Ian,

Thanks for your help.  I have LV 6.1 so I can't open your attached files.  However, Aart-Jan's advice did the trick.

Thanks anyway,

Jerome.

0 Kudos
Message 7 of 19
(10,202 Views)
I have created an action engine to do this in some of my apps.  Look at this document and create an action engine that will init, open, close, and kill your window.  The closing of the reference when the vi is called by vi server will close the vi and remove it from memory.  Check it out.
 
 
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 8 of 19
(10,192 Views)
I love utilities and this is a very useful utility. I do wonder why you used a string control instead of an enum, though. And the "command" must be a required input to prevent undesired behaviour.
0 Kudos
Message 9 of 19
(10,180 Views)
I use a string out of habit.  Enums are great but I have been using strings for years.  If I am forced to I will 🙂  I typically have a developer error case to handle all misspellings, etc.  I just put this together really quick and didn't properly document it.  Just figured I would contribute.  The main point is to encapsulate this functionality into one vi to allow for flexibility. 
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 10 of 19
(10,077 Views)