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>.
The macro is implemented in one of the repository .NET assembly objects: <.NET assembly namespace>.<class name>.<macro name>.
In the repository units and forms, user macros must be implemented in the Global Scope of names.
In repository .NET units and .NET forms, user macros must be implemented within a class. A macro must be a static procedure or function.
To execute the example, create a unit with the Module identifier containing the ModMapClick procedure. Add links to the Ui, Report, Forms.NET (for Fore.NET example) 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, the report 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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
The unit for a message with a territory code:
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Ui;
Imports Prognoz.Platform.Forms.NET;
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;
The unit for assigning a map event handler:
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase;
Report: IPrxReport;
TabSheet: ITabSheet;
Map: IPrxMap;
Begin
Metabase := Params.Metabase;
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.Program.ModMapClick";
(Report As IMetabaseObject).Save();
End Sub;
See also: