LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch the interface between 2 vi, by click bottons on them

I have 2 vi(A.vi, B.vi) in runtime, each one has its interface.
 
I want to add one button a on A and one b on B.
 
When I click a, it will link to B and show B.
When I click b, it will link to A and show A.
 
Any ideas,
 
0 Kudos
Message 1 of 4
(3,282 Views)
One easy way is the following: build a main while loop where vi A is run if the loop index is even (i.e. the remainder of its integer division by 2 is 0), vi B is run if the loop index is odd (the remainder is 1), or viceversa, of course. This way you dont' need a special button to toggle between A to B, rather you need a button on each subvi to exit from the loop: when you press this button, each subvi should terminate outputting a given boolean value (commonly true) that you should wire to the loop termination condition,
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 4
(3,278 Views)
I don't think that is what the poster had in mind, and I can't quite figure out how this accomplishes what the poster is trying to do, but maybe I just misunderstood the intention.

What I would do is in each of A.vi and B.vi create a reference to the "other" vi using the "Open VI Reference" function. Then, in the response to the button press you just need to call the method (using the "Invoke" function) to open the front panel. In LabVIEW 8.2 it's in the "Front Panel->Open" list of methods. You can read more about the VI Server functions in the LabVIEW User Manual and check the examples that ship with LabVIEW.
0 Kudos
Message 3 of 4
(3,262 Views)

The attached zip file shows how to use references and methods to control the front panel of a subvi.  To go back to the main, add a button with similar code on the subvi.  The vi uses the FrontPanel.Open method to show/hide the subvi.

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 4
(3,251 Views)