AreaAction: String;
The AreaAction property determines a macro to handle map events.
NOTE. The development environment object containing implementation of the macro must be connected to the regular report.
Depending on the file where the macro is implemented the path to the macro in this property is specified in the different ways:
The macro is implemented in the repository unit or form: <unit/form identifier>.<macro name>.
The macro is implemented in one of the repository assembly objects: <assembly identifier>.<macro name>.
In the repository units and forms, user macros must be implemented in the Global Scope of names.
To execute the example, create a unit with the Module identifier containing the ModMapClick procedure. Add links to the Ui and Report system assemblies.
Sub ModMapClick(TerrId: Variant; Map: IPrxMap);
Begin
WinApplication.InformationBox("Territory code = " + (TerrId As Integer).ToString);
End Sub ModMapClick;
Create a regular report with the REGULAR_REPORT identifier, which sheet contains a map with source data. Add the created unit to report units.
Create a unit that assigns an event handler for a map. Add links to the Metabase, Report, Tab system assemblies.
Sub UserProc;
Var
Metabase: IMetabase;
Report: IPrxReport;
TabSheet: ITabSheet;
Map: IPrxMap;
Begin
Metabase := MetabaseClass.Active;
Report := Metabase.ItemById("REGULAR_REPORT").Edit As IPrxReport;
TabSheet := (Report.ActiveSheet As IPrxTable).TabSheet;
Map := TabSheet.Objects.Item(0).Extension As IPrxMap;
Map.AreaAction := "Module.ModMapClick";
(Report As IMetabaseObject).Save;
End Sub UserProc;
A map event handler is added in the regular report, clicking any of the regions displays a message with a territory code.
See also: