02-03-2011 05:50 AM
Hi guys,
I want to define some constants like "Garry" = 2; "Leo" = 5; "Ray" = 110. And then use this string defines in a case structure. The switch/selector has to be an integer number.
02-03-2011 05:52 AM
Hi JoVMo,
you can use a ring for it.
Mike
02-03-2011 06:22 AM
I found a typecast on an enum constant. But can u explain more bout the ring? What kind of ring?
02-03-2011 07:35 AM
Hi JoVMo,
the ring constant is in the same palette as the enum.
Mike
02-03-2011 07:47 AM
Ah ok, the enum has sequential values and the ring can use random values. 😉 got it
02-03-2011 07:47 AM
Enum's cant have dispersed values in LV, they're always 0..X, with a Ring control you can set each option to hold a value.
Enum's on the other hand connect their names to a Case, in the case of the Ring the cases will be named 0..x.
/Y
02-03-2011 10:06 AM
One other thing regarding rings and ENUMs. You can typedef an ENUM which means that all instances of it will be updated when the typedef is modified. You cannot do the same with a ring. You will need to programmatically initialize it and you will have to manually maintain all case structures that use it. If you change the strings in the ring the case structures are not automatically updated like an ENUM typedef. The ring will allow you to use non-sequential values but it does come with a cost of ease of maintenance.