LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check if the numeric control button has been pressed

Solved!
Go to solution

Basically have a numeric control that starts at zero and the user can tick it up or down. Every time it is ticked/pressed up by one i want to do something. Is there a way to find this property? It does not seem to be listed as an option under the property node list for the control.

0 Kudos
Message 1 of 9
(3,909 Views)

Sounds like perfect job for Event (value change) structure;)

0 Kudos
Message 2 of 9
(3,899 Views)

Event Structure.  Use the Value Changed event.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 9
(3,894 Views)
Solution
Accepted by topic author labview12110

As Adam suggested, a value change event is the way to go.

 

value_change_event.png

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvprop/ctrl_value_changed/

Message 4 of 9
(3,891 Views)

What does the sand timer 100 symbol in the corner do?

0 Kudos
Message 5 of 9
(3,888 Views)

It sets a timeout for the event structure so it doesn't just sit there forever waiting for something to happen.  The event structure will execute again on your next while loop iteration though.

 

http://zone.ni.com/reference/en-XX/help/371361K-01/glang/event_structure/

0 Kudos
Message 6 of 9
(3,884 Views)

Works like a charm ! thanks!

0 Kudos
Message 7 of 9
(3,877 Views)

Be careful doing comparisons on floats, and you can eliminate the comparison & constant by wiring the result directly to the Case selector terminal.  I don't doubt that Drew_H knows this and was just demonstrating the concept, but I'll add this for the benefit of any new users that see the example and wonder why "= -1" never results in True (except when there's a whole number in the control). <Edit - I take it back.  I can't make it not work (except when I decrement)>

 

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 8 of 9
(3,848 Views)

While we're on the subject of event structures, why have a timeout unless you want to something while waiting for input?  It just turns it into a complicated polling loop.  If you really needed to do something while waiting, you could just dispense with the event structure altogther and just put a little wait in there to keep the loop from spinning out of control.  And if you wanted to do something while the event loop was waiting, there are still more efficient ways to do this.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 9
(3,840 Views)