09-10-2014 07:40 AM
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.
Solved! Go to Solution.
09-10-2014 07:50 AM
Sounds like perfect job for Event (value change) structure;)
09-10-2014 07:51 AM
Event Structure. Use the Value Changed event.
09-10-2014 07:51 AM
As Adam suggested, a value change event is the way to go.
http://zone.ni.com/reference/en-XX/help/371361J-01/lvprop/ctrl_value_changed/
09-10-2014 07:53 AM
What does the sand timer 100 symbol in the corner do?
09-10-2014 07:54 AM
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/
09-10-2014 07:58 AM
Works like a charm ! thanks!
09-10-2014 08:38 AM - edited 09-10-2014 08:43 AM
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)>
09-10-2014 08:41 AM - edited 09-10-2014 08:43 AM
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.