Creating and Settings Up Event Handler

Event handler is a Fore unit. Event handler provides a possibility to set actions when a particular event occurs enhancing functionalities of the workspace.

NOTE. Setting event handler is available only in the desktop application.

Creating Event Handler Automatically

To create an event handler, select the Event Handler > Create > Create Fore Unit item on the Home ribbon tab.

An event handler can also be created in the Event Handling dialog box. Select the Event Handler > Setup item on the Home ribbon tab. In the dialog box that opens select the Create > Create Fore Unit item.

After executing those actions, the standard dialog box to select object in object navigator opens:

Created unit or assembly contain ready structure where there are all events for workspace:

Example of Unit

Connecting Event Handler

To connect event handler, select the Event Handler > Set Up item on the Home ribbon tab:

In the dialog box that opens select unit and class where an event handler is located:

  1. Select a Fore unit containing a class with the event handler in the Unit box. One can select an object in the drop-down list or click the icon and enter object name. To remove the object from the box, click the button.

  1. In the Class box select class containing event handler. One can select a class in the drop-down list or click the icon and enter class name. To remove the class from the box, click the button.

To set up and edit events in the development environment, click the Open in the Development Environment button.

Example of Unit

Executing the example requires that the unit contains the Eventclass class. Add links to the Ui and Workspace system assemblies.

Class EventsClass: WorkspaceEvents
    Public Sub OnBeforeOpenWorkspace(Args: IUiWorkspaceCancelEventArgs);
    Begin
        Winapplication.InformationBox("Message before opening workspace");
        Args.Cancel := False;
    End Sub OnBeforeOpenWorkspace;
End Class EventsClass;

As a result of event handler work, the specific message is displayed before opening the workspace.

See also:

Building a Workspace