LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

gray out some enum values

I was wondering if there was anyway to gray out some of the values in a enum.  For example if i have three values 50 100 200 and i want 200 to be visible in the enum but would like to gray and have it nonfunctional. 
Mark Mutton
Electrical Engineer
Message 1 of 4
(3,622 Views)
Of course. You can do it from the front panel by choosing the value and then right click and select Disable Item. You can do it programatically with the Disabled Items[ ]  property. Create an array of the items you want disabled and pass it in.
Message 2 of 4
(3,616 Views)
Select the value, right click the enum and select "Disable Item". You can do this programmatically by using the Disabled Items property.

___________________
Try to take over the world!
Message 3 of 4
(3,613 Views)
This was a slight challenge to me also. Not least because the enable state of items is somewhat random, determined by what the user is doing (state of the program).
The easier way was to create a control array with each element corresponding to a particular Enum list item. To disable, I set the corresponding array element to the item number I wanted disabled. To enable the item, I just set the array element to an invalid value (e.g. -1). It works, but there is a slight chance it may change something it isn't supposed to change.
The 'proper' way was to read the current DisabledItems[] list and add or remove item numbers from it.
I'll attach a library with examples of both.. The library includes a vi to add or remove elements containing certain values from an array. It may be useful if others need to do the same thing.
Cheers.
John
0 Kudos
Message 4 of 4
(3,422 Views)