NI Home > Community > NI Discussion Forums

LabVIEW

Reply
Member
jrpe
Posts: 176
0 Kudos

limiting visible enum choices

[ Edited ]
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
Knight of NI
Knight of NI
tst
Posts: 10,799
0 Kudos

Re: limiting visible enum choices

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!
Proven Zealot
johnsold
Posts: 9,810

Re: limiting visible enum choices

[ Edited ]
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
Active Participant
PhillipBrooks
Posts: 1,172

Re: limiting visible enum choices

[ Edited ]
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

Member
jrpe
Posts: 176
0 Kudos

Re: limiting visible enum choices

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 :smileyvery-happy:
 
anyway, thanks everyone!
Jeff


Using Labview 7 Express
Knight of NI
Knight of NI
tst
Posts: 10,799

Re: limiting visible enum choices

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!
Member
jrpe
Posts: 176
0 Kudos

Re: limiting visible enum choices

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