IUndoRedo.Storage

Syntax

Storage: IUndoRedoStorage;

Description

The Storage property returns summary information storage of undo/redo stack.

Comments

Summary information stores the common number of undo/redo actions available for the current object and its child objects.

Example

Executing the example requires a form, the ReportBox and UiReport components and four buttons on the form. Create event handlers for the buttons. The UiReport component is a data source for ReportBox. The report connected to the UiReport component contains a chart on an active sheet.

Add links to the Report, Tab system assemblies.

Class SAMPLEForm: Form
    UiReport1: UiReport;
    ReportBox1: ReportBox;
    Button1: Button;
    Button2: Button;
    Button3: Button;
    Button4: Button;
    CheckBox1: CheckBox;
    URReport, URChart: IUndoRedo;

    Sub SAMPLEFormOnCreate(Sender: Object; Args: IEventArgs);
    Var
        Report: IPrxReport;
        Tab: ITabSheet;
        Chart: IPrxChart;
    Begin
        Report := UiReport1.Report;
        // Undo/redo stack of entire report
        URReport := Report.UndoRedo;
        URReport.Enabled := True;
        URReport.Limit := 20;
        // Undo/redo stack of chart
        Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
        Chart := Tab.Objects.Item(0).Extension As IPrxChart;
        URChart := Chart.UndoRedo;
    End Sub SAMPLEFormOnCreate;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        Debug.WriteLine("---Undo/Redo Report---");
        Debug.WriteLine("   Enabled: " + URReport.Enabled.ToString);
        Debug.WriteLine("   RedoCount: " + URReport.RedoCount.ToString);
        Debug.WriteLine("   UndoCount: " + URReport.UndoCount.ToString);
        Debug.WriteLine("   Storage count: " + URReport.Storage.Count.ToString);
    End Sub Button1OnClick;

    Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        Debug.WriteLine("---Undo/Redo Chart---");
        Debug.WriteLine("   Enabled: " + URChart.Enabled.ToString);
        Debug.WriteLine("   RedoCount: " + URChart.RedoCount.ToString);
        Debug.WriteLine("   UndoCount: " + URChart.UndoCount.ToString);
    End Sub Button2OnClick;

    Sub Button3OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        If URReport.UndoCount <> 0 Then
            URReport.Undo;
        End If;
    End Sub Button3OnClick;

    Sub Button4OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        If URReport.RedoCount <> 0 Then
            URReport.Redo;
        End If;
    End Sub Button4OnClick;
End Class SAMPLEForm;

When a form opens, data of undo/redo stack of the loaded report and the chart located on an active sheet is obtained. Clicking the first button displays information about the current undo/redo stack of the report, including summary information about all available actions in the development console. Clicking the second button displays information about undo/redo stack of the chart in the development console. The third and the fourth buttons undo or redo actions executed in the report.

See also:

IUndoRedo