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.
To create an event handler, select the item:
Select the Event Handler > Create > Create Fore Unit item on the Home ribbon tab.
Select the Event Handler > Create > Create .Net Assembly item on the Home ribbon tab.
The event handler can be also created in the Event Handling dialog box:
Select the Event Handler > Setup item on the Home ribbon tab. In the opened dialog box, select the Create > Create Fore Unit item.
Select the Event Handler > Setup item on the Home ribbon tab. In the opened dialog box, select the Create > Create .Net Assembly 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:
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:
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.
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.
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: