Event Handlers
Event handlers are specialized methods. Each class in the DataFlex class library raises certain events during important operations. For example, the TreeView class supports many events such as:
- OnCreateTree: This event is executed when a TreeView object is created.
- OnItemChanged: This event is executed whenever the focused item in a TreeView moves from one item to another.
These events are the points at which you can design specialized behavior for the class during important operations. You design the specialized behavior by writing the appropriate event handler in your class declaration. You need to study the documentation for each class to determine which event methods are available for augmentation.
Example of Augmenting Event Methods
An example of augmenting event methods follows:
Class cMyButton is a Button
Procedure OnClick
Send Info_Box "I have been clicked"
End_Procedure
End_Class
In this example, we have designed a new button class called cMyButton. The OnClick event has been augmented so that each time the button is clicked, a message will be displayed.