LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

return from subvi

Hello.
I have checked this forum and can`t find the answer to this question all though there are lots of topics about it.

I want to have a main vi. This vi will be the menu for the sub vi`s.

I have made a subvi called mode1, and a centervi. When I start the centervi and press the button for the sub vi to start, this works all fine. The sub vi pops up and is running.

My problem occur when I want to return back to the center vi. I have tried some things, but it doesnt work.

So my question is: how do you return to the main vi??????

I would prefer that the return button on the sub vi will close the sub vi and return to the main vi.But this is not necessary.

Hope someone can help me....

I have uploaded the centervi and the subvi for you to look at!!!

Thanx!!

Tommy
Download All
0 Kudos
Message 1 of 9
(4,442 Views)

In your subVI, after the loop completes, drop an Invoke Node, change it to the VI class, and select the "Close FP" method.  This will close your subVI's front panel, effectively returning you to the main VI.

-D

0 Kudos
Message 2 of 9
(4,434 Views)
All you have to do is wire the "return to main vi" button to the while loop's conditional terminal instead of your constant.
0 Kudos
Message 3 of 9
(4,428 Views)
hello again.. and thanx for the response..

I have tried both.. but I`m not sure if I have understand.

Is it possible for any of you to download my files, and upload them corrected??

Tommy..
0 Kudos
Message 4 of 9
(4,416 Views)

Message Edited by Dennis Knutson on 04-21-2006 04:03 PM

0 Kudos
Message 5 of 9
(4,415 Views)

here is your ,, ans,,.,, i have attached ,, two vis,,

 

and,, here,, this ,,, event structore ,so it let you enter from the "return" key press .. and,, escap as the same,,

this all funda,, is of  flag,, and,, only one vi will stay open at the taskbar ,, at one time,, mark that also,,

 

take care,,,

manisha

 

0 Kudos
Message 6 of 9
(4,402 Views)
The first suggestion doesnt do it, It just stops the subvi and thats it. It doesnt make the program return to the center vi.

The second suggestion works. But it`s so complicated. Are there no easy answer to this.. ????

Tommy...
0 Kudos
Message 7 of 9
(4,397 Views)
You are doing this way too complicated!
 
The only thing needed is to end the subVI as Dennis already pointed out, BUT you need to setup the node properly in the calling VI.
 
Right-click on the subVI in the main VI and select  "SubVI node setup..." and configure to open FP when called and close afterwards.
(You had it set to open when loaded and don't close afterwards :()
 
Now make sure that the subVI panel is closed before running the main VI!
 
(Please also note that UI while loops without a wait statement are evil. They spin millions of times, doing nothing but repeating the same calcualtions over and over again while consuming 100% of the available CPU. You can easily do everything with event structures. (Place an indicator in the iteration terminal in your version and my modified version for a comparison. See any difference? :))
0 Kudos
Message 8 of 9
(4,391 Views)
This was exactly what I was looking for altenbach:)

Thanks...
0 Kudos
Message 9 of 9
(4,373 Views)