Type ControlCharacters = (
CTL_AKNWLDGMNT : Char = #6, //Control character; acknowledgment.
CTL_BACKSPACE : Char = #8, //Control character; backspace.
CTL_BELL : Char = #7, //Control character; bell ("ding") sound.
CTL_CANCEL : Char = #24; //Control character; cancel.
CTL_CRGRTRN : Char = #13, //Control character; carriage return.
CTL_DATALINK : Char = #16 //Control character; data link.
);
Type DrawingCharacters = (
DWG_ALT179 : String = '│', //Drawing character; line - single vertical. Equal to {Alt+179}.
DWG_ALT180 : String = '┤', //Drawing character; right coupler - single vertical/single horizontal. Equal to {Alt+180}.
DWG_ALT181 : String = '╡', //Drawing character; right coupler - single vertical/double horizontal. Equal to {Alt+181}.
DWG_ALT182 : String = '╢', //Drawing character; right coupler - double vertical/double horizontal. Equal to {Alt+182}.
DWG_ALT183 : String = '╖', //Drawing character; right upper connector - double vertical/single horizontal. Equal to {Alt+183}.
DWG_ALT184 : String = '╕' //Drawing character; right upper connector - single vertical/double horizontal. Equal to {Alt+184}.
);
Both Type enumerations above are non-functional mockups do demonstrate my needs.
For string enumerations, the techniques proposed so far will often work, though not always, especially if the string is long. It wouldn't make sense to have an enumeration element name that is 50 characters long.
Also, in such cases as above, it is not feasible to use the shown literal values and hash values as element names, either. In most case, it is the element value I need to access and not the element name. In cases where the required value would always be a number, this would not be an issue. However, the required value often needs to be a string or a character, which enumerated types do not allow.
I need...
ShowMessage(DrawingCharacters.DWG_ALT182); //Displays "╢"
rather than...
ShowMessage(DrawingCharacters.DWG_ALT182); //Displays "DWG_ALT182"
So, unless types structs are implemented, similar to...
Struct CriticalErrors : int64 //Enumerated constant type named "CriticalErrors' - of type int64...
AccessViolation = 4;
AppDomainUnloaded = 3;
BadImageFormat = 5;
CantUnloadAppDomain = 6;
ExecutionEngine = 7;
InvalidProgram = 9;
NonCritical = 1;
OutOfMemory = 2;
StackOverflow = 8;
ThreadAbort = 10;
End;
Struct CalendarDays : String //Enumerated constant type named "CalendarDays' - of type String...
Day01 = 'Sunday';
Day02 = 'Monday';
Day03 = 'Tuesday';
Day04 = 'Wednesday';
Day05 = 'Thursday';
Day06 = 'Friday';
Day07 = 'Saturday';
End;
I think it will just be more efficient for me to continue using regular constants in Object Pascal.