Object properties are set by executing a DataFlex Set statement. The syntax of the set statement is:
Set {property-name} [of {object-Id}] To {value}
Where:
{property-name} is the name of the property that is being set;
{object-ID} is a handle to the object whose property is being set and
{value} is the new value of the property. The value can be any constant, variable or expression that is of a compatible type to the property.
If you are setting a property of the current object (current instance of the class) then you can use the Self Keyword as the object-id. Refer to the section on the Self keyword for more details. Alternatively you can omit the object-id clause completely and DataFlex will automatically reference the current object. An example of a class declaration that sets properties of the current object are:
Class cOKButton is a Button
// Constructor:
Procedure Construct_Object
Forward Send Construct_Object // very important!
Property Integer piClickCount 0
Property String psBusyLabel ""
Set Label To "OK"
// same as writing… Set Label of Self To "OK"
Set Status_Help To "Click OK to begin operation"
Set psBusyLabel To "-Busy-"
End_Procedure
End_Class
The above example sets three properties: Label, and Status_Help are properties that were inherited from the superclass; psBusyLabel is a new property. A property must be declared before you can set it.
In the above example all the property settings occur in the constructor method. However you can set properties of the current object inside any method that is part of the class definition.
If you are setting a property of some other object then you need to provide a handle to that object in the {object-Id} part of the Set statement. The DataFlex Handle type can be used to create variables or properties for storing object handles. Examples of set statements that set properties of some external object are:
Set Checked_State of oMarried_Checkbox To True
Set Minimum_Position of oSpinForm To 0
Set Maximum_Position of oSpinForm To 100
In the above examples, oMarried_Checkbox is the name of an instance of the Checkbox class and oSpinform is an instance of the SpinForm class. Both these classes are built into the DataFlex class library.
You cannot use the Move statement to set a property value. The Move statement is only for assigning values to variables.