![]() |
|
|||||||
| CQC Support Report bugs, make wishes, discuss plans, ask questions |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Is it possible to get the text of an enum, without first assigning it to a variable?
So, if there is an enum that defines: Enum Myenum stuff : "ThisStuff"; EndEnum Can I then reference in the code: Myenum.stuff.GetText() and get "ThisStuff"? I'm thinking I CAN'T, and I'm thinking that instead of an enum, I should probably just declare constants for what I want instead.
__________________
My Android Weather Alert App |
|
#2
|
||||
|
||||
|
You ahve to actually create an enumerated value and set it. But if you are looking for something use in a driver to translate back and forth between an internal and external value, enums are very much designed to do that.
What you do is set the left side to the internal and the right side to the external (or vice versa), and you can do SetText() or SetName() on it from the text, then read the other value out. You do need to put an exception handler around it though, in case the text/name you are setting turns out not to be one of the actual values.
__________________
Dean Roddey Software Geek Extraordinaire |
|
#3
|
|||
|
|||
|
Well, what I had was an enumerated list of strings that represented certain status requests (PowerStatusReq, VolumeStatusReq, etc). They were all related, in that they were all status requests, but otherwise, they really don't benefit from being enumerations. I'll just change 'em to literals.
__________________
My Android Weather Alert App |
![]() |
| Thread Tools | |
| Display Modes | |
|
|