LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using enumerated types with classes

I'm probably missing something fundamental here, but when I create a enumerated type in the ctl of a class, and later unbundle the class and create a control, indicator or constant off of the enumerate type, I only get the corresponding interger object, not the enumerated values (i.e. if I wanted a ring control, I would instead just get a standard integer control). Am I messing up here? I feel like I've gotten clusters to unbundle enumerated types before, but maybe I'm forgetting something. Thanks in advance!
0 Kudos
Message 1 of 5
(3,117 Views)

Did you make your enum a type def?

 

Felix 

Message 2 of 5
(3,113 Views)
I hadn't, I did. It didn't change anything. Then I changed the control used from one of the ring controls to one of the enum controls and it worked. I didn't realize the controls were different in any measurable way.
0 Kudos
Message 3 of 5
(3,100 Views)

Well, that is the difference of them actually. Rings are not strict with their values, so you can set them during run-time (so good for UI design). Enums on the other hand are fixed string-number associations. So you also have the string representation available in the IDE, such as wiring an enum to a case selector.

 

Felix 

0 Kudos
Message 4 of 5
(3,096 Views)

I guess I'll be a bit more specific with my issue:

 

I want to be able to create constants off this input with the drop down selector that appears with an enum. However, I'm having issues reconciling places where it doesn't appear an enum is used, but I need to use one to replicate the functionality. For instance, in IMAQ: If I wire an image to the property node to get the image type, and then create a constant off of that, it'll give me an enumerate list of possibilities. However, if I turn this constant into a control and try to use it in the ctl of my class, the output from the property node won't interface with the input to my private copy of image type without saying that the types don't match up. This might be totally irrelavent and it might work, but I'd rather get the types working corrently.

 

Am I doing something wrong in this case? If I just make my private copy of image type a ring control, it will work properly with the output from the property node, but then it doesn't create the default list of things when I go to make constants or UI elements with the class copy, instead using a regular numeric input.

 

In C, this would be a piece of cake. Just get the type definition, and we can play together harmoniously. But while I clearly have access to the type definition (since I can create a constant off of the property node), it's like I'm not allowed to use that definition later on. I dunno, I'm bothered by it even if it makes no difference.

0 Kudos
Message 5 of 5
(3,075 Views)