LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enumerated Type Remove Item Potential Bug

I think I may have found a bug with removing items from an enumerated type. Basically, start off with an enumerated type and set its default value to be the last item in the list. Then, copy the enumerated type and delete the first one or two items from the list. The values of subsequent items will be lowered accordingly. However, when you select "Operate->Reinitialize All To Default", the copy shows the same selected item as the original, but it also has the same "value" as the original, even though it was changed when items were removed. In fact, if you select the last item, the "value" of the enumeration will change to the correct value.

I've attached a VI that shows this. I'd swear this looks like a bug.
0 Kudos
Message 1 of 3
(2,679 Views)
I guess you could argue that it's a bug, but I don't think so. You told LabView to give it a default value of 5, so it does. But it no longer has 5 as the value for any item in the list, so when you operate the control, you can't get back to 5. Whenever you deleted your items from the list, you should have saved a new default value.
This feature (to have a default value not on the list) could possibly be of value to the programmer: you can tell whether or not the user operated the control.
Message 2 of 3
(2,679 Views)
As you pointed out, one could argue as to whether or not it's a bug, since it depends on how you look at it and whether or not it's operating the way it's supposed to. As to the former, it's debatable. I can see how it can be seen as a "feature", as I've used a similar ploy with numeric controls and setting them to NaN or +Inf to indicate they haven't been wired. If it's seen as such it should probably be documented someplace, as I suspect it isn't. As to the latter, only those who designed and wrote LabVIEW can really answer the question.

Appreciated the input...

-Saverio
0 Kudos
Message 3 of 3
(2,679 Views)