LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close a .vi

Hey all.  I have searched through the forums and found a lot of good info but not exactly what I am looking for.  What I have is a .vi that I use to choose which path of programs my software takes basically.  This .vi works as a Menu type GUI and each choice starts up a different user inteface.  What I am looking for is a way ot Start the second .vi and then close the original "Menu."  I tried a few tricks I have found on here but what happens is either, the Top most .vi closes itself before it can run the second level .vi, or the second level .vi starts and the Top Level .vi code freezes waiting for the called .vi to complete and then won't shut itself down, or the top level .vi shuts down and the second level .vi loads but then stops executing.

its all very confusing.

If you need more info I can try to be a little more detailed and attach some code, but any help would be great.
0 Kudos
Message 1 of 11
(6,658 Views)
You may want to post an example of your code, even a couple of screen shots of the block diagram.  You should be able to do what you want using invoke nodes on the VI such as Run VI, front panel open, close,  ....  Make sure wait until done is not set on your top level menu VI.  You could also pass the reference of the top level vi to the vi's it starts and allow them to close the menu vi.
0 Kudos
Message 2 of 11
(6,645 Views)
Thanks for the reply.  I will work on getting together something to show you all.  After talking to my users it looks like they want to be able to go back up to the "Menu" vi if their procedures call for it.  Right now what I am doing is making the .vi transparent 100% so I may just do that and give them a "Return to Menu" button on the second level GUI's and have that close the second GUI and set the top level to 0 on the transparency.
0 Kudos
Message 3 of 11
(6,638 Views)
Perhaps the "Menu" should be a pop up VI rather than the main VI. The main VI just sits in the background and calls up the appropriate user interface subVIs, including the "Menu." Depending on how often a new item needs to bee added to the Menu and how many there are, other GUI options might be worth considering. Putting all GUI into on VI (Main?) and switching tab control pages for the different UI appearances might be simpler than invoke nodes, but it depends on how many different UIs you need.

As Ravens Fan said, posting code or screen shots will be helpful.

Lynn
0 Kudos
Message 4 of 11
(6,626 Views)
Ok, well here is a screenshot of the code for my "Menu" GUI.  Notice it si running and has executed to the point that is called the sub-vi.  I have th eexecution highlighted and you can see the green arrow on the sub-vi.  For this try I have the front panel transparent.  This seems like it might be an ok solution if its all I can do.  The idea of the Menu being a pop-up to another vi is tempting but im not sure how i would implement it.

what i am thinking is that since my users want an option to go back to the menu, i may just put that button into the sub-vi's and have it stop those sub vi's and then restore the menu to opacity (is that a word?).

What do you think of that idea?


0 Kudos
Message 5 of 11
(6,595 Views)
0 Kudos
Message 6 of 11
(6,587 Views)
That's exactly the kind of thing I am after!!

Thanks a million!!
0 Kudos
Message 7 of 11
(6,580 Views)
Generally you do not want code executing inside an event case which will take more than tens of milliseconds to complete because it blocks the loop and the event structure from responding to other events. The subVIs should be running in a parallel loop. Using queues to tell the subVI that the button has been pushed works well.

Is the subVI expected to run on both T -> F and F -> T changes of the button? If not, you need to look at the NewVal terminal or move the button terminal inside the event case. With the terminal inside the event case, you can use latching mechanical action which simulates a momentary pushbutton.

Lynn
0 Kudos
Message 8 of 11
(6,567 Views)
I have tried looking into queue's before but I really cant wrap my mind around them.  (I am not a programmer by education) 

The vi that is inside my case structure is definately not going to complete ni milliseconds.  more like minutes or hours.  Is that going to od something bad other than just make the case structure sit there until i an finished?  there is nothing else happening in that code.
0 Kudos
Message 9 of 11
(6,561 Views)
It does not really do anything bad in the sense of crashing the computer or corrupting data. What it does is to make the user interface completely unresponsive. This is basic dataflow. Any node (loop, function, subVI,..) may begin to execute only after data is present at all its inputs. And a loop will not complete its execution until all nodes inside it have completed. If the user wants to stop the program, say, because the wrong parameters were entered, the program would not respond to a stop button until the subVI completed.

Event structures are powerful tools for creating versatile and responsive user interfaces. Typically they are used only for the GUI and they just send commands to the "working" code which runs tests, collects data, or whatever. That working code is running in parallel and neither part causes the other part to wait.

Lots of people who use LabVIEW are not formally trained programmers. However, to write effective programs in LV (or any other language for that matter) you have to understand how the language does things. If you have not done so, go through the LabVIEW tutorials. I think you will find it time well spent.

Look at the Producer/Consumer Design patterns found in the file menu at New.. >> VI >> From Template >> Design Patterns ... ( I do not have LV open, so the path may be slightly different.)

Lynn
0 Kudos
Message 10 of 11
(6,545 Views)