LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

limiting visible enum choices

Hi, this is probably a pretty easy question, but I couldnt find the answer when searching for it.
 
I have an enum control on my front panel like so
 
 
 
And it controls one portion of my program that is set up as a state machine. Two of those states I do not want to be user-accessible, so I would like to remove those options from the control, however if i simply remove them from control, it makes my case statement in my state machine all messy (instead of the case being Process, it is called 3 and if I rename it Process, the VI breaks). I know you can disable enum options like so
 
 
 
but I would rather that the greyed out values simply be invisible. Of course I could make a new enum (without the two values) and use a case statement to convert that to the current enum...but I think that would come pretty close to the realm of rube goldberg code...
 
any suggestions for a more elegant solution would be appreciated,
 
thanks a lot!
 
 


Message Edited by jrpe on 11-20-2007 11:35 AM
Jeff


Using Labview 7 Express
Download All
0 Kudos
Message 1 of 7
(3,341 Views)
You should preferably not use enums as UI controls. Your proposed Goldberg solution is actually a reasonably common one, except with using rings instead of enums.

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(3,324 Views)
You could encapsulate the conversion case structure in a subVI with a very small icon if you want to save diagram space.

Lynn

Message Edited by johnsold on 11-20-2007 01:04 PM
Message 3 of 7
(3,318 Views)
You could create a text or menu ring and disable "sequential values" using the "edit items" right click dialog. Set the ring's values to match the indexes of your accessible commands. Then use typecast to convert the text or menu ring value to your enum.

You could also use a property node to get the value of RingText.Text and use Scan from String with the default value set to the an instance of the enum...




Message Edited by Phillip Brooks on 11-20-2007 01:24 PM

Message Edited by Phillip Brooks on 11-20-2007 01:26 PM

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Download All
Message 4 of 7
(3,312 Views)
alright thanks a lot, I think I will go with the typecasting method. Mainly because while they all take up pretty much the same amount of space, but the typecast method uses the typecast...and i dont get to use it very much...and it looks so exciting...haha Smiley Very Happy
 
anyway, thanks everyone!
Jeff


Using Labview 7 Express
0 Kudos
Message 5 of 7
(3,301 Views)
If you want to be safe, I would suggest writing a VI to do the conversion using a case structure. This will protect you against things like localizing your UI, changing data type representations in LV (which is something the type cast relies on) and potential bugs in the conversion.

___________________
Try to take over the world!
Message 6 of 7
(3,288 Views)
alrighty then! safe way it is haha. thanks for the tip, although I do kind of regret not being able to use the typecast...maybe some day.
 
thanks again
Jeff


Using Labview 7 Express
0 Kudos
Message 7 of 7
(3,284 Views)