Setting Up Event Handler

To set up map event handlers, use the Parameters tab in the Map Properties dialog box.

To display the Map Properties dialog box

In the Event Handler box specify name of the macro used for handling the event on the map territory click. The method of indicating path to the macro depends on the macro implementation location:

In the units and forms of the repository, user macros are to be implemented in the global scope of names (Global Scope).

In .NET units and .NET forms of the repository, user macros are to be implemented within a class. The macro should be a static procedure or function.

NOTE. A development environment object that contains implementation of a macro is to be connected to a regular report.

Example of an Event Handler

To connect a macro to the chart, create a unit in the Object Navigator dialog box:

Sub ModMapClick(TerrId: Variant; Map: IPrxMap);
Begin
    WinApplication.InformationBox("Territory code = " + (TerrId As Integer).ToString);
End Sub ModMapClick;

where TerrId - territory code; Map - the map itself.

To execute the example, add links to the Report and Ui system assemblies.

The corresponding Fore.NET handler looks as follows:

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Forms.NET;
Imports Prognoz.Platform.Interop.Ui;

Public Shared Sub ModMapClick(TerrId: object; Map: IPrxMap);
Var
    WinAppCls: WinApplicationClass = New WinApplicationClassClass();
Begin
    WinAppCls.InformationBox("Territory code = " + (TerrId As integer).ToString(), Null);
End Sub ModMapClick;

Attach the created unit to the report. After attaching the unit, specify macro name in the Event Handler box on the Parameters tab of the Map Properties dialog box.

After attaching the macro, a message appears in case a territory in the map is addressed, such as:

See also:

Handling Report Events | Units: Report Units and Event Handling | Map Features in Regular Report