LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Opening and Closing SubVIs

I am an electrical engineering student who has been assigned a project
with LabView. All that I have learned with LabView has been
self-taught (slowly and painfully I should add). I would like to open
a subVI front-panel that I have created, and then close the subVI so
that I may return to my original front panel, or move onto a next
subVI. (The operation would be similar to any Windows base program
were panels are opened and closed)

I have tried various settings on the "SubVI node setup..." but have not
had this work successfully. If anyone could offer any help, that would
be GREATLY appreciated.

0 Kudos
Message 1 of 13
(3,581 Views)
On the subvi, right-click the connector pane -> VI Properties -> Window appearance -> Customize -> Show front panel when called + Close afterwards... 
Message 2 of 13
(3,560 Views)

This should be no problem. Just select open FP when called and close afterwards. (Then make sure the panel is closed before you run the main VI that calls it).

How are you calling the subVI? Attach a small example and we'll fix it for you. 😉

Message 3 of 13
(3,558 Views)
In the sub vi open the properties window.In that select the window
appearence category.There select the dialog option.This would work
well.
For more cosmetic appearence select the custom option button
and select the customise button.There check or uncheck the options you
want.Moreover.But dont forget to check

1.show front panel when called

2.close afterward if closed.

Message 4 of 13
(3,541 Views)
Thank you so much for your help. Turns out, my button had improper
properties; it was set for "switch when pressed" instead of "latched
when pressed". I had the subVI node properties set up properly (per
your recommendations), so when I changed the button properties, all is
well now. I'm sure I may have more questions as this project
progresses. Thanks again.

0 Kudos
Message 5 of 13
(3,519 Views)
Pardon me for jumping in on this thread -

I found this discussion useful in performing the same task of showing a sub-VI front panel when it was called, but I have run into problems. 

Within a while loop, the sub-VI is called when a boolean control is switched to true.  The sub-VI merely takes two clusters and displays them on a chart.   I arranged the properties of the sub-VI to show front panel when called and close front panel when finished.  I am assuming that it is finished when I go back to the main window and switch the boolean control back to false.  However, the window doesn't close when I switch this to false.  Occasionally, the sub-VI also flickers, which I assume is a result of the while loop around the case structure. 

This sounds confusing, let me know if you want more than just a picture of the VI, or if a picture of the sub-VI in question would be useful.



Brad
0 Kudos
Message 6 of 13
(3,476 Views)
Here is the sub-VI I am trying to call - it is still a work in progress-
0 Kudos
Message 7 of 13
(3,465 Views)
You're seeing flickering because the subVI is constantly being opened and closed. The subVI has no while loop it to keep it running and give anyone a chance to look at it. The mechanical action of your Boolean is probably set incorrectly as well. If you want a simple "view" button, set the mechanical action to Latch When Released. Then in the subVI, put a while loop inside the no error case. Terminate the while loop with a front panel Boolean. Now, if you do it this way, your main VI will be paused while the subVI is displayed. If that's what you want, you're done. If it's not, expalin exactly what you do want.
0 Kudos
Message 8 of 13
(3,452 Views)
Thanks for the tip on the buttons, Dennis.  I now have the VI boolean button latching when released, and the sub-VI in the while loop controlled by a button that switches until released.  The windows behave correctly like that, but I must say that the description of "Latch when released" and "Switch when released" are awfully similar and I probably wouldn't have figured that out without a sagely tip.

Now for the bad news.  I had tried a while loop in the sub-VI before, and the result was that the graphs only show one datum at a time (I think).  The x axis (time) moves very fast, is a very large integer, and the graphs are a straight line.  The y-axes yield integers even though they are set to plot clusters of double precision numbers represented in scientific notation.  If I get rid of the while loop, the graphs behave properly, but the windows do not.  Because of this fact, I don't think that it is the graph properties that are causing this odd behaviour.

Brad
0 Kudos
Message 9 of 13
(3,443 Views)
After further contemplation, I realize that the reason the graph is a "flatline" is because the main VI is inactive when the sub-VI is being viewed.  This will not work because the data come from the main VI when the sub-VI is being viewed!  In addition, I would like the main VI to be active, or at least usable while the graphs are being viewed so that a user can open and close valves while watching the pressure traces on the graph.  The reason is because some users are better suited to graphical analysis and others like the numeric displays.  I am trying to keep both happy.

Thanks for any input,
Brad
0 Kudos
Message 10 of 13
(3,439 Views)