Declaring Properties

The syntax for declaring a new property is:

Property {property-type} {property-name} {initial-value}

  Where:

Class properties must be declared inside the Constructor method of the class. The name of every class's constructor method is Construct_Object. Refer to the sections on Constructors and Destructors for more information. An example of declaring a class with two new properties is:

Class cOKButton  is a Button

    // Constructor:

    Procedure Construct_Object

        Forward Send Construct_Object  // very important!

        Property Integer piClickCount  0

        Property String  psBusyLabel  "-Busy-"

        Property String[] psValues

    End_Procedure

End_Class

This example declares a class, cOKButton, with three new properties, piClickCount, psBusyLabel and psValues. Note that the properties are declared inside the class constructor method, Construct_Object. An important part of the Construct_Object method is the "Forward Send Construct_Object" statement. This is the line that ensures that all of the definitions in the superclass's constructor are inherited by the new class.

DataFlex property naming convention suggests that you prefix all property names with p followed by a letter that indicates its data type(i, n, r, b, d, s, v, h). Refer to the appendix on Naming Conventions for more information.