Skip to content

Declaring New Methods

In addition to creating object properties, DataFlex supports the creation of new methods inside an object declaration statement. These methods are unique to the object they are being declared in and are not shared by other objects of the same class. The following example demonstrates how you can define a new method within an object declaration statement:

Object oOK_Button is a Button
    Set Location to 20 90
    Set Label to "OK"
    Property Integer piClickCount 0

    Procedure OnClick
        Integer iClickCount
        Forward Send OnClick
        Get piClickCount To iClickCount
        Set piClickCount To (iClickCount + 1)
    End_Procedure
End_Object

In the above example, the class's OnClick method is augmented to increment an integer property.

Refer to Methods in the Classes section for more information.