Enumeration
From Real Software Documentation
An enum or enumeration is a set of constants. It is a group of constants that are assigned values. By default, the constants are numbered consecutively, starting with zero. You can assign a value to each constant or accept the default values.
When you create an enumeration, you create a new data type. Enumerations accept only Integer constants. When you want to get an enumeration, you need to cast it to an Integer data type.
You add an Enumeration in the IDE. You can add an Enumeration only to a module or to a class. In either case, use the Project> Add > Enum submenu to display the Enum declaration area. Name the module and set its data type to integer. To add the first Enum, click the plus sign and type in the name of the first enum. It will get the default value of 0 unless you set it to another value. If you want to override the default value, set it to another integer value using the assignment operator. To create the next Enum values, click the plus sign and repeat the process.
For more information on creating an Enumeration, see the section Adding an enumeration to a module in the Users Guide.
You refer to an Enum in your code using dot notation. If the Enum has Global scope it is referred to as:
If it is Public scope, it uses the module name or the class name in the notation:
or:
Examples
Consider a global Enumeration named "SecurityLevel" that has four constants: Unauthorized, Minimal, Maximum, and Forced. Their values range from 0 to 3.
You use the dot notation to get the values of the items. For example, the expression
accesses the value of 2 because Maximum is the third constant in the Enum definition.
To return the integer 2, you need to explicitly cast the Enumeration using the desired integer data type. There is no implicit conversion from the Enumeration data type to an integer data type. For example, the following code in a window returns the integer value 2.
