Enumerated datatypes
About enumerated datatypes
Like the system object datatypes, enumerated datatypes are
specific to PowerScript. Enumerated datatypes are used in two ways:
-
As arguments in functions
-
To specify the properties of an object or control
You can list all the enumerated datatypes and their values
by selecting the Enumerated tab in the Browser.
You cannot create your own enumerated datatypes. As an alternative,
you can declare a set of constant variables and assign them initial
values. See “Declaring constants”.
A variable of one of the enumerated datatypes can be assigned
a fixed set of values. Values of enumerated datatypes always end
with an exclamation point (!). For example, the enumerated datatype Alignment,
which specifies the alignment of text, can be assigned one of the
following three values: Center!, Left!, and Right!:
|
1 |
mle_edit.Alignment=Right! |
Incorrect syntax
Do not enclose an enumerated datatype value in quotation marks.
If you do, you receive a compiler error.
Advantages of enumerated types
Enumerated datatypes have an advantage over standard datatypes.
When an enumerated datatype is required, the compiler checks the
data and makes sure it is the correct type. For example, if you
set an enumerated datatype variable to any other datatype or to
an incorrect value, the compiler does not allow it.