# Hammad # Posted June 1, 2009 Report Share Posted June 1, 2009 I have a simple problem How to switch between two VIs inside a project in LabVIEW 8.5 ? Here is a rared file to illustrate what i need , sorry i couldn't attach it simple project Quote Link to comment
dannyt Posted June 2, 2009 Report Share Posted June 2, 2009 QUOTE (# Hammad # @ May 31 2009, 06:15 PM) I have a simple problemHow to switch between two VIs inside a project in LabVIEW 8.5 ? Here is a rared file to illustrate what i need , sorry i couldn't attach it http://www.mediafire.com/download.php?nozddl2dfbt' rel='nofollow' target="_blank">simple project Hi, I cannot open rar files some could not look at your sample. However I am not sure I understand your question either, what do you mean by "switch" ? could you give some more detail Quote Link to comment
# Hammad # Posted June 2, 2009 Author Report Share Posted June 2, 2009 QUOTE (dannyt @ Jun 1 2009, 12:54 PM) Hi, I cannot open rar files some could not look at your sample. However I am not sure I understand your question either, what do you mean by "switch" ? could you give some more detail dannyt, Thank you for your interest this is what i need to do I have 2 VI files each of them has a button switch when you are in VI#1 and press the button VI#1 is closed VI#2 is opened when you are in VI#2 and press the button VI#2 is closed VI#1 is opened This is what I meant by switching between two VIs 1 Quote Link to comment
Popular Post hooovahh Posted June 2, 2009 Popular Post Report Share Posted June 2, 2009 Here's a quick and dirty way of doing what you want. It just shows or hides one window or the other based on a VIG. Run the Start Engines VI since it is the new top level one. It will run both the Login and Main windows. One will be shown the other hidden. Once the user presses the button on that window, it will hide itself and show the other, but they are both constantly running. EDIT: sorry I posted it in 8.6, now there is one for 8.5 3 Quote Link to comment
# Hammad # Posted June 2, 2009 Author Report Share Posted June 2, 2009 hooovahh Thank you This is exactly what I need but the solution is very complicated. Is there another simpler solution ? 1 Quote Link to comment
asbo Posted June 3, 2009 Report Share Posted June 3, 2009 Here's a method that uses a relative path to open a VI reference. The VI reference allows you to manipulate the other VI at run-time. You can execute either VI, but because there is absolutely no communication between the VIs, they don't know which one started first, so both will be visible initially. As soon as you click the switch button, one will hide and the other will stay visible. This is just an example to illustrate the concept for you, you should not just plunk this down into your project and expect things to work spiffy. If you have questions about this method, fire away. 2 Quote Link to comment
dannyt Posted June 3, 2009 Report Share Posted June 3, 2009 QUOTE (# Hammad # @ Jun 1 2009, 11:02 PM) hooovahhThank you This is exactly what I need but the solution is very complicated. Is there another simpler solution ? Hi Hammad How new a user are you to LabVIEW ? are you familiar with how to call a subvi and set that subvi to open its front panel when called. If you are a new user, I am wondering if you have really defined what you were wanting fully. I managed to open your original rar file and you just have two VI's a main Vi and a login VI. So are you really aiming for something as simple as :- run main.vi and when a button is pressed on that VI, you wish the login.vi to pop up allow a user to login and then for the login VI to disappear ? Dannyt Quote Link to comment
# Hammad # Posted June 7, 2009 Author Report Share Posted June 7, 2009 QUOTE (asbo @ Jun 2 2009, 02:12 AM) Here's a method that uses a relative path to open a VI reference. The VI reference allows you to manipulate the other VI at run-time. You can execute either VI, but because there is absolutely no communication between the VIs, they don't know which one started first, so both will be visible initially. As soon as you click the switch button, one will hide and the other will stay visible.This is just an example to illustrate the concept for you, you should not just plunk this down into your project and expect things to work spiffy. If you have questions about this method, fire away. That's great But I want the hidden VI to be closed I tried to test some methods such as Abort VI, Run VI but the didn't work as I expected and I think that I need some help about that because I found no details about Invoke Node methods in the LabVIEW help Do you have any document about the Invoke Node and its methods ? Thank you QUOTE (dannyt @ Jun 2 2009, 11:29 AM) I managed to open your original rar file and you just have two VI's a main Vi and a login VI. So are you really aiming for something as simple as :- run main.vi and when a button is pressed on that VI, you wish the login.vi to pop up allow a user to login and then for the login VI to disappear ? Dannyt Hi Dannyt I'm aiming for that In my project The buttons Go to main VI and Back to login VI are buttons that I want them to function as Sign in and Sign out Run the login.vi When user logs in using his account (This is done in my project using voiceprint but here I'm using the button Go to main VI for simplicity),I need to close (Not hide) login.vi and run (Not show) the main.vi When user finishes his work with main.vi, he signs out using the button Back to login VI and then, I need to close main.vi and run login.vi again This is what I need, sorry for any mismatch Quote Link to comment
asbo Posted June 9, 2009 Report Share Posted June 9, 2009 dannyt seems to have been more insightful than I was and figured out what you were actually going for. You're going to want to learn up on state machines (I see 3 states, minimum: idle, login, and logout). You'll have a parent VI which calls either main.vi or login.vi. You'll need to decide how you want to keep track of whether the user is logged in or not - you can use globals and call the global where ever needed or you could use a shift register in the parent vi and have the state passed as an input to main.vi or login.vi. 1 Quote Link to comment
# Hammad # Posted June 10, 2009 Author Report Share Posted June 10, 2009 Hi all, I modified asbo's solution after reading about the Invoke node and its methods from Lesson2-LabVIEW IntermediateII I think I reached what I need, tested it, and I see that it worked Check the file is in the attachments Thank you all (dannyt, hooovahh, asbo) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.