LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing state of button

Solved!
Go to solution

Hi, I'm new to labview and I have a couple questions.  I've come to a point in my code where I am stuck.  I've attached the code so you can see where I am.  My problem comes into play with the toggle button.  I need to know if there is a way to change it's operation based on a condition.  I'd like to have it to where when you press the button, it stays pressed.  But if it meets a condition, it turns itself off.  In my code, I have a point where I need to output a message, but because the state of the button doesn't change, it keeps outputting the message unless I turn the program off.

 

If this makes sense, does anyone know of a solution to this?

 

Thanks so much for the help in advance.

0 Kudos
Message 1 of 5
(8,009 Views)
Solution
Accepted by JJJOndae
You can use a local variable of that control inside the case structure where you write a false to it for it to pop back up when you need to.  Your not actually changing its operation, but it allows you to programmatically change the current state of the button.
Message 2 of 5
(7,992 Views)
What Ravens Fan wrote is correct. I have attached a modified version of your VI (LV 8.6) with the local variable inside the message loop. I've also changed the operation of the control to 'switched when pressed' to fulfill your requirement.

Just some friendly tips

1.  Could you please name your VI to indicate its function. Will help you and other members in the long run.

2.  Indicate your version of LV so that you may be helped accordingly.

Hope this helps!!!

Cheers!!!
Message Edited by Mani's World on 05-17-2010 03:55 AM
Message Edited by Mani's World on 05-17-2010 03:57 AM
Message 3 of 5
(7,973 Views)

Thanks for the help, makes sense.  I'll try and implement it later when I have a chance and let you know if I have any success.

 

Sorry I am running version 8.2 at the moment, so I couldn't open the file!  Could you save it to 8.2?  Thank you so much.

0 Kudos
Message 4 of 5
(7,955 Views)

Here's the 8.2 version

 

Cheers!!!

 

 

Kudos are the best way of expressing thanks!!!

Message 5 of 5
(7,939 Views)