Jump to content

How to switch between two VIs inside a project in LabVIEW 8.5


Recommended Posts

QUOTE (# Hammad # @ May 31 2009, 06:15 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

Link to comment

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

  • Like 1
Link to comment

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.

  • Like 2
Link to comment

QUOTE (# Hammad # @ Jun 1 2009, 11:02 PM)

hooovahh

Thank 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

Link to comment

QUOTE (asbo @ Jun 2 2009, 02:12 AM)

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

  1. Run the login.vi
  2. 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
  3. 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

Link to comment

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.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.