2.59 .constant

If this attribute is set to true a variable can become a read-only variable and as a result becomes a constant variable. After that it is impossible to release the write-protection. However if the variable contains an object reference then the variable value will become null when the object is destroyed (e.g. by the built-in function destroy()).

Definition

  • Data type

    boolean

  • Access

    get, set

  • changed event

    yes

This attribute is only available for the variable object (see also manual “Rule Language”).

More elegant than using this attribute is the use of the keyword constant instead of variable to directly define a constant variable in the static definition section of a dialog or module.

Example

dialog D
variable integer V := 123;
constant integer C := 456;
on dialog start
{
  C := V;    // evaluation error because C cannot be changed
  V := 234;  // OK
  V.constant := true;
  V := 345;  // error - variable is now write-protected
}