IEaxMapChart.Action

Syntax

Action: String;

Description

The Action property determines a macro to process map events.

Comments

Depending on the file where the macro is implemented the path to the macro in this property is specified in the different ways:

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

NOTE. Development environment object, where macro implementation is, must be connected to regular report.

Example

Executing the example requires that the repository contains the following:

It is required that the example contains the Action macro, which will be used as an event handler.

Add links to the Drawing, Express, Metabase, Report, Tab, Topobase, Visualizators system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Report: IPrxReport;
    Module: IMetabaseObjectDescriptor;
    ActiveSheet: IPrxSheet;
    Assemb: IPrxAssemblies;
    i: Integer;
    Table: IPrxTable;
    Objects: ITabObjects;
    AddObj: ITabObject;
    Obj: IPrxVisualizer;
    DA: IEaxDAtaArea;
    Slice: IEaxDataAreaSlice;
    SlObj: IEaxObject;
    MapChart: IEaxMapChart;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get regular report
    Report := MB.ItemById("REG_REPORT_ACTION").Edit As IPrxReport;
    // Connect unit with macro to regular report
    Module := MB.ItemById("IEAXMAPCHART_ACTION");
    Assemb := Report.Assemblies;
    i := Assemb.Add(Module);
    // Create new object  - visualizer
    ActiveSheet := Report.ActiveSheet;
    Table := ActiveSheet As IPrxTable;
    Objects := Table.TabSheet.Objects;
    AddObj := Objects.Add("PrxVisualizer"New GxRectF.Create(00100100));
    Obj := AddObj.Extension As IPrxVisualizer;
    // Get analytical data area
    DA := Report.DataArea;
    // Get data slice
    Slice := DA.Slices.Item(0);
    // Add map as visualizer
    SlObj := Slice.Views.AddByType(EaxObjectType.MapChart) As IEaxVisualizer;
    Obj.EaxVisualizer := SlObj As IEaxVisualizer;
    MapChart := Obj.EaxVisualizer As IEaxMapChart;
    MapChart.Enabled := True;
    MapChart.Visible := True;
    MapChart.Topobase := MB.ItemById("MAP").Edit As ITopobase;
    // Determine macro to process events
    MapChart.Action := "REG_REPORT_ACTION.Action";
    MapChart.DoAction("RF");
    // Refresh map
    MapChart.Refresh;
    // Save changes
    (Report As IMetabaseObject).Save;
End Sub UserProc;

// Event handler
Public Sub Action(n: Variant);
Var
    Table: IPrxTable;
    Objects: ITabObjects;
    Object: IPrxVisualizer;
    MapChart: IEaxMapChart;
    Map: IVZMapChart;
    i: Integer;
    RootLayer: IVZMapChartLayer;
    Shapes: IVZMapChartShapes;
Begin
    If n.IsNull Or n.IsEmpty Then
        Return;
    End If;
    // Get map as visualizer
    Table := PrxReport.ActiveReport.ActiveSheet As IPrxTable;
    Objects := Table.TabSheet.Objects;
    Object := Objects.Item(0).Extension As IPrxVisualizer;
    MapChart := Object.EaxVisualizer As IEaxMapChart;
    Map := MapChart.MapChart;
    // Get map layer
    RootLayer := Map.RootLayer.LayerById("Regions");
    // Get map territories
    Shapes := RootLayer.Shapes;
    // In the G8 cell will be displayed territory identifier
    If n.VarType = ForeVariantType.String Then
        For i := 0 To Shapes.Count - 1 Do
        If Shapes.Item(i).Name = (n As String) Then
            Table.TabSheet.Cell(77).Value := Shapes.Item(i).Name;
        End If;
        End For;
    End If;
End Sub Action;

After executing the example, visualizer basing on the map will be created in regular report. The map will use the event handler, which implements mouse click on the territory with the RF identifier. As a result, the G8 cell displays territory name.

See also:

IEaxMapChart