01-28-2010 08:51 AM
Hello forum members
I use a numeric control knob with text labels instead of numbers:
For best code readability I'd like to use the text values (not the control's integer value) in a case structure as selector values directly.I could use the"Text Labels[]" or the "Digital Displays[] property, if I could cast it to a ring or enum.
The LabVIEW help proposes :
Text Labels[] Property Dim hasPlayer, playerversion hasPlayer = false playerversion = 10 Do While playerversion > 0 On Error Resume Next hasPlayer = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & playerversion))) If hasPlayer = true Then Exit Do playerversion = playerversion - 1 Loop is_FlashVersion = playerversion is_Flash = hasPlayer
If you want to create non-sequential numeric values, use the Digital Displays[] property to get a reference to the text label display then cast the reference to the Ring class and use the Strings And Values [] property.
But I do not understand, how to perform the casting or if I am misunderstanding the help.
Does somebody have a suggestion?
Thanks!
Klaus
Solved! Go to Solution.
01-28-2010 09:13 AM - edited 01-28-2010 09:14 AM
01-28-2010 09:49 AM
Thank you, this explains perfectly the LabVIEW help topic.
I believe now that it is not possible to use such a labeled dial like an enum control for feeding a case selector "by text".
Regards
Klaus
01-28-2010 09:53 AM
01-28-2010 10:02 AM - edited 01-28-2010 10:02 AM
Klaus M wrote:I believe now that it is not possible to use such a labeled dial like an enum control for feeding a case selector "by text".
Depends on what you mean by "like an enum". The text label can be wired to a case structure. You would need to manually set the case element selectors, however, for the various cases you have. You cannot dynamically create the enum, if that's what you're fishing for. You can, however, have the enum defined as a typedef and cast it.
01-28-2010 03:00 PM
Yes, smercurio_fc, dynamically creation, that's what 've been fishing for.
I'll do it as you propose. A typedef is anyway best practice for creating maintainable and save code.
Thanks for the quick help!
Klaus