Object properties are read by executing a DataFlex Get statement. The syntax of the get statement is:
Get {property-name} [of {object-Id}] To {variable-id}
Where:
{property-name} is the name of the property that is being read;
{object-ID} is a handle to the object who's property is being read and,
{variable-id} is the name of a variable that will receive the property's value. The receiving variable can be any variable that is of a compatible type to the property.
If you are reading 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 reads properties of the current object are:
Class cCount_Button is a Button
// Constructor:
Procedure Construct_Object
Forward Send Construct_Object // very important!
Property Integer piClickCount 0
End_Procedure
Procedure OnClick
Integer iCount
Get piClickCount To iCount
Move (iCount + 1) To iCount
Set piClickCount To iCount
Set Label To iCount
End_Procedure
End_Class
The above example declares a class, based on the Button class, with a new property, piClickCount. The button class is designed to execute a method called OnClick each time the button is 'clicked' on by the mouse (this is called an event method). The OnClick method has been defined to read the piClickCount property into a variable, increment it, set the property back to its incremented value and also display the value in the button's label (by setting the label property).
If you are reading a property of some other object then you need to provide a handle to that object in the {object-Id} part of the Get statement. The DataFlex Handle type can be used to create variables or properties for storing object handles. Examples of get statements that read properties of some external object are:
Get Checked_State of oMarried_Checkbox To bChecked
Get Minimum_Position of oSpinForm To iMax
Get Maximum_Position of oSpinForm To iMin
In the above examples, oMarried_Checkbox is 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.