Using Events with Class Objects

23.08.2021

To create an event routine for an event affecting all FlexPro objects of a certain type, the event procedure has to be entered into one of the object modules AnyCursorObject, AnyDocObject, AnyFolder, AnyFormula, AnyFpObject or AnyValueObject . You can create such an event procedure by following these steps:

1.For instance, double-click on AnyFpObject in your template project or database project in the "Project Explorer" window. (In the folder view, AnyFpObject can be found in the FlexPro Objects folder.)

2.Select FpObjectClass from the Object drop-down list box.

3.Select an event from the Procedure drop-down list box.

An empty sub-routine is added to the class module.

4.Add the Visual Basic instructions to be executed when the event occurs.

The following example shows a ObjectModified event procedure in a template project, which is executed if an FpObject object is changed.

Private Sub FpObjectClass_ObjectModified(ByVal Object As Object)

    MsgBox Object.Name & " was modified."

End Sub

If an event procedure for a FpObject event exists in a database and template database, both event procedures are executed.

Note:   You can find out whether a certain FlexPro object belongs to one of the object classes AnyCursorObject, AnyDocObject, AnyFolder, AnyFormula, AnyFpObject or AnyValueObject in Overview of FlexPro's Object Hierarchy.

Share article or send as email:

You might be interested in these articles