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,
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-200701:24 PM
Message Edited by Phillip Brooks on 11-20-200701:26 PM
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
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.