Search
FlowChart.BeginUndoRecord Method
See Also
 



( a feature of FlowChartX Pro edition)

Creates a composite undo record.

 Syntax

VB6  Copy Code

Public Sub BeginUndoRecord ()

C++  Copy Code

public:
void BeginUndoRecord ()

 Remarks

Creates a composite undo record. All other undo records created between BeginUndoRecord and EndUndoRecord calls are added to the composite. Invoking Undo or Redo while a composite record is current in the undo queue, makes all operations recorded in the composite undo or redo themselves. This can be useful if you need to present a series of atomic operations as an integral undoable operation.

It is not recommended the BeginUndoRecord and EndUndoRecord calls to span several interactive FlowChartX actions, i.e. do both invocations in a single event handler or method of your application. If you need to create a composite record that encloses several interactive actions, better use the MergeUndoRecords method.

 Example

Imagine your application provides color palette for changing the color of selected nodes. Changing properties of boxes is not recorded for undo/redo, unless property changes are made between Box.BeginUndoRecord and Box.EndUndoRecord calls. Everything between those calls is recorded as a single atomic operation. However if there are more than one boxes selected, you would prefer to have all changes undoable with a single call to Undo. To achieve this you might use code like the following:

VB6  Copy Code

Private Sub Command1_Click()

    Dim b As box

    'composite record
    fcx.BeginUndoRecord

    For Each b In fcx.SelectedBoxes

        'programmatic property changes must be between Begin/EndUndoRecord
        b.BeginUndoRecord False
        b.TextColor = selectedColor
        b.FrameColor = selectedColor
        b.EndUndoRecord

    Next b

    fcx.EndUndoRecord

End Sub

 See Also