08-10-2011 08:08 AM
Hello all,
I am mechanical engineering student and am relatively new to labview. I was wondering if it was possible to make a single button that would cycle through all possible cases in a numerical case structure. I am planning on replacing the button later with an “actual” button through a CRIO and want to use as few channels as possible (since I have a large number of buttons/LED etc). I am currently using a numerical control; the problem is it has up and down button and the numerical display which ideally don’t want. All suggestions/solutions would be much appreciated.
Cheers
Solved! Go to Solution.
08-10-2011 08:24 AM
Sounds like you want to make a state machine: Application Design Patterns: State Machines
As far as the button is concerned, you could cheat and place a transparent ring control over a button. When you click the button you just increment the value of the ring. The downside is that if you have the mouse over the ring, then you can select the ring.
An alternative is to change the strings of the button to match the state. Attached is a crude example to give you an idea.
08-10-2011 10:09 AM
You can use an enum, and trap the mouse-down event. See attachment.
08-11-2011 06:14 AM
Hi,
Thanks for the quick response, i have tried to play around with my progamme and using the one you have attached but i still cant get the output (colour box) to also cycle, i managed to get the ok button to but the colour box stayed the same. Here is a simplified version of my orginal problem. Thanks again.
08-11-2011 06:16 AM
Hello pcardinale,
Thanks for response also but i am running labview 9 not 10 so can't see your solution.
08-11-2011 08:07 AM
Now I don't undestand what you mean by cycle. I see no OK button, and the numeric control doesn't cycle. When did the color box come into play? You made no mention of this before.
Please be more clear in what you are trying to do.
Also, never create a Greedy Loop.
08-11-2011 08:29 AM
Sorry for the confusion this is my first post on NI forums and very new to labview (as I'm sure you can tell!), basically I want to replace the numerical controller with the OK button which cycles (exactly what your vi did but I also want it to control the color of the color box). The fact the numerical controller doesn't cyle is my exact problem (and the hardware complication mentioned previously). The colourbox is being used to show several states in a larger program (so essentially its a multicloured version of a Boolean LED). Hope that has cleared things up. Thanks for the speedy response(s).
08-11-2011 10:27 AM
08-11-2011 12:18 PM
Just add colorbox output to the case structure.