08-30-2013 12:02 PM
Hi everyone,
I am designing a useful interface for a programmable robotic system.
Firstly, i wanted to add a language selection to make easy the interface for the users. This is ok.
When the user select "the language", then "the second program" must be opened. So, i called "the second program vi" in the block diagram of "main vi".
The problem is that:
When the second program (my subvi) opens, the main page (first vi) must be closed. But i couldn't find the way to close the first vi.
I tried some of ways but they didn't work. Do you know a simple way to close the first vi? and also the second vi must continuously run.
If you download the 3 files and open only the "page1" file, You will understand what i want to say, and you can see my block diagram codes for calling subvi.
Please help me.
08-30-2013 12:29 PM
Please save your code in LV 12 or earlier. Many of us haven't upgraded to 13 yet.
Cameron
08-30-2013 12:40 PM - edited 08-30-2013 12:40 PM
ok, i edited them
08-30-2013 12:51 PM
After calling the other vi, use STOP and then FP.Close with the current vi reference. Do NOT use ABORT as this will stop all running vi.
08-30-2013 01:01 PM
I don't see any reason you have to close your main VI. The easiest thing to do, since you only want to address this question once, is to make your current mainVI a subVI which pops up on top of the (as yet unmade) mainVI, then closes when your language choice is made, telling the new mainVI where to go.
Cameron
08-31-2013 05:19 AM
I dont want to close all of the programs. I just want to create some kind of passing pages. i mean, when the first page is opened and one language is selected, later this program must close itself and open the process page. This situation just like a web site. when you select a language on a web site, then the main page opens. I want to create this kind of design.
If you think there is another simple way to design labview like a web site system, please tell me.
09-03-2013 10:41 AM
Well, I don't set things up quite like a web page, and I don't think most here really do, either. My main VI (whatever name it has) determines the overriding architecture for the program, and subVIs (with or without branching) are called inline from the main VI.Things do not have to be strictly sequential, it's more like a website which was run through a Perl (or other scripting language) engine, and the sequence of VIs is that engine.
So, for your case, the main VI might start (without any user interface of its own, maybe a splash screen if you want, or a dot 1 pixel square) and immediately call up a subVI which asked for the user's language preference. The answer to this would take you back to the main VI, which would then take that preference and pull up either an English or a Turkish (?) subVI via a case sequence. From there you could use a state machine to do your business, which would take different routes, depending on further choices. There is no reason to close your main VI until you close the whole program. I don't know if this is meant for multiple users one after the other, but when one user is finished, you could even go right back up to the main VI to call the language subVI to take care of the next user (or just go back to the beginning of your business VI, giving the user a button to switch to the other language anyway).
There are many ways to do it, because you can make any subVI front panels visible or not, depending on whether they are for interacting with the user or doing work behind the scenes. All you have to do is make sure you close every front panel that is still open at the end (which costs only milliseconds or less).
Cameron
09-03-2013 11:03 AM
Another option is to open the subvi in a sub-panel of your main vi (this way to don't even need to worry about closing it). Thread here is a more specific problem but still addresses sub-panels. http://forums.ni.com/t5/LabVIEW/Sub-Panel-in-Application-Builder/m-p/1070818/highlight/true#M474471
A way to make this look seemless is to use a tab control and place your language prompt in tab 1 and the sub-panel in tab 2. Once the user selectes a language, load the desired vi into the sub-panel and switch to tab 2. If you hide the tab controls and make it's border transparent, the user will never even know it's there.
But going back to your original question, call the sub-vi by reference and close the language vi using the Front Panel Close invoke node. Calling the subvi by reference prevents it from stopping when your language selection vi closes.