Creating and Settings Up Event Handler

To set up handling of the workspace events, use event handler.

Event handler is a unit created on the Fore language or an assembly created on the Fore.NET language.Event handler provides a possibility to set actions when a particular event occurs enhancing functionalities of the workspace.

Creating Event Handler Automatically

To create an event handler, select the item:

The event handler can be also created in the Event Handling dialog box:

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:

Fore unit example

Fore.NET assembly example

Connecting Event Handler

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

In the opened dialog box select unit and class where an event handler is situated:

  1. Select Fore unit or Fore.NET assembly containing class with event handler in the Unit field. It is possible to select an object from the drop-down list or click the icon and input object name. To delete object from the field, click the button.

  1. In the Class field select class containing event handler. It is possible to select a class from the drop-down list or click the icon and input class name. To class object from the field, click the button.

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

Example of Unit

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

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

After event handler processing, before the workspace opens, the Message Before Opening a Workspace is displayed.

See also:

Building a Workspace