ChartExternLegendSetup Command

Purpose

Opens a standard dialog box to set up parameters of the legend created for regular report charts.

Parameters of Use

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

Value type Description
Element 1: IPrxReport A regular report, on a page of which a chart legend is created.
Element 2: IPrxChartLegend A chart, for which the parameter setting dialog box is to be displayed.

Application Features

The command is used only for regular reports. Executing the command shows True if the OK button has been clicked in the dialog box, and False if the Cancel button has been 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. An active sheet of the regular report connected to the UiReport1 component contains a chart legend.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Report: IPrxReport;
        Objs: ITabObjects;
        Obj: ITabObject;
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
        Data: Array;
        i: Integer;
    Begin
        Report := UiReport1.Report;
        Objs := (Report.ActiveSheet As IPrxTable).TabSheet.Objects;
        //Searches legend on regular report page
        For i := 0 To Objs.Count - 1 Do
            If Objs.Item(i).ClassId = "PrxChartLegend" Then
                Obj := Objs.Item(i);
                Break
            End If;
        End For;
        If Obj <> Null Then
            Target := WinApplication.Instance.GetPluginTarget("Report");
            Context := Target.CreateExecutionContext;
            Data := New Variant[2];
            Data[0] := Report;
            Data[1] := Obj As IPrxChartLegend;
            Context.Data := Data;
            Target.Execute("ChartExternLegendSetup", Context)
        End If;
    End Sub Button1OnClick;

Clicking the button opens a standard dialog box that is used to set up parameters of the legend found on the active sheet of the regular report connected in the UiReport1 component.

Fore.NET Example

Executing the example requires a form, the Button1 button on this form, the ReportBoxNet component and the UiReportNet component named UiReportNet1, which is used as a data source for the ReportBoxNet component. An active sheet of the regular report contains a chart legend.

Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
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
        Report: IPrxReport;
        Objs: ITabObjects;
        Obj: ITabObject;
        WinApp: WinApplicationClassClass = New WinApplicationClassClass();
        Svc: IForeServices;
        RunContext: ForeRuntimeContext;
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
        Data: Array;
        i: Integer;
    Begin
        Report := UiReportNet1.ReportUi.Report;
        Objs := (Report.ActiveSheet As IPrxTable).TabSheet.Objects;
        //Searches legend on regular report page
        For i := 0 To Objs.Count - 1 Do
            If Objs.Item[i].ClassId = "PrxChartLegend" Then
                Obj := Objs.Item[i];
                Break
            End If;
        End For;
        If Obj <> Null Then
            Svc := Self.Metabase As IForeServices;
            RunContext := Svc.GetRuntime().Context;
            Target := WinApp.Instance[RunContext].GetPluginTarget("Report");
            Context := Target.CreateExecutionContext();
            Data := New object[2];
            Data[0] := Report;
            Data[1] := Obj As IPrxChartLegend;
            Context.Data := Data;
            Target.Execute("ChartExternLegendSetup", Context, RunContext);
        End If;
    End Sub;

Clicking the button opens a standard dialog box that is used to set up parameters of the legend found on the active sheet of the regular report connected in the UiReportNet1 component.

See also:

IUiCommandTarget.Execute