LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

closing main vi while sub vi is running

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.

Download All
0 Kudos
Message 1 of 8
(2,925 Views)

Please save your code in LV 12 or earlier. Many of us haven't upgraded to 13 yet.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 8
(2,918 Views)

ok, i edited them

Download All
0 Kudos
Message 3 of 8
(2,909 Views)

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.

0 Kudos
Message 4 of 8
(2,902 Views)

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

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 8
(2,898 Views)

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.

0 Kudos
Message 6 of 8
(2,872 Views)

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

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 7 of 8
(2,813 Views)

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.

0 Kudos
Message 8 of 8
(2,800 Views)