MapLegendSetup Command

Purpose

Opens a standard dialog box that is used to set up parameters of the map legend located on one of the sheets of regular report.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify an array of the Variant type in this property, the elements of this array contain the following values:

Value type Description
Element 1: IPrxMapLegend The map legend, for which the parameter setup dialog box is to be displayed.
Element 2: IPrxReport The regular report, on a page of which a map and a legend are created.

Application Features

The command can be used only for regular reports. Executing the command shows True if the OK button is clicked in the dialog box, and False if the Cancel button is clicked.

Fore Example

Executing the example requires a form with the Button1 button, the ReportBox component and the UiReport component named UiReport1, which is used as a data source for the ReportBox component. The active sheet of the regular report connected to the UiReport1 component contains a map and a map legend with the PrxMapLegend1 identifier.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Rep: IPrxReport;
    Legend: IPrxMapLegend;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
Begin
    Rep := UiReport1.Instance As IPrxReport;
    Legend := (Rep.ActiveSheet As IPrxTable).TabSheet.Objects.Object("PrxMapLegend1"As IPrxMapLegend;
    Target := WinApplication.Instance.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext;
    Data := New Variant[2];
    Data[0] := Legend;
    Data[1] := Rep;
    Context.Data := Data;
    Target.Execute("MapLegendSetup", Context);
End Sub Button1OnClick;

Clicking the button opens a standard dialog box that is used to set up map legend parameters.

Fore.NET Example

Executing the example requires a form, the Button1 button on the form, the ReportBoxNet component and the UiReportNet component named UiReportNet1, which is used as a data source for the ReportBoxNet component. The active sheet of the regular report connected to the UiReportNet1 component contains a map and a map legend with the PrxMapLegend1 identifier.

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Ui;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    Rep: IPrxReport;
    Legend: IPrxMapLegend;
    WinApp: WinApplication = New WinApplicationClass_2();
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
Begin
    Rep := UiReportNet1.ReportUi.Report;
    Legend := (Rep.ActiveSheet As IPrxTable).TabSheet.Objects.Object["PrxMapLegend1"As IPrxMapLegend;
    Target := WinApp.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext();
    Data := New Object[2];
    Data[0] := Legend;
    Data[1] := Rep;
    Context.Data := Data;
    Target.Execute("MapLegendSetup", Context, Null);
End Sub;

Clicking the button opens a standard dialog box that is used to set up map legend parameters.

See also:

IUiCommandTarget.Execute