Objects are instantiated by executing an object declaration statement. The syntax of the object declaration statement is:
Object {object-name} is a {class-name}
{property-settings}
{nested-object-declarations}
End_Object
Where:
You may initialize any properties that belong to the object's class inside the object declaration block. Object declarations can also be nested allowing you to declare one object inside another. Refer to the section on Object Nesting for more information.
An example of an object declaration is:
Object oOK_Button is a Button
Set Location to 20 90
Set Label to "OK"
End_Object
The above example declares an object of the Button class and initializes the Location and Label properties. The DataFlex naming convention for objects is to prefix the object name with the letter 'o'. This will help you to identify and separate object names from other identifiers in large applications.
Declaring new properties and methods in an object is a very useful feature of the DataFlex language. It is quite common that each instance of a class will need to have slightly different attributes and/or methods. To declare a new class for each slight variation is quite tedious. Another way would be to design more flexible classes but the disadvantage here is that this flexibility often introduces unwanted complexity.