TCustomRichViewEdit.BeginUndoCustomGroup2, EndUndoCustomGroup2

<< Click to display table of contents >>

TCustomRichViewEdit.BeginUndoCustomGroup2, EndUndoCustomGroup2

An alternative method to group operation for undo.

procedure BeginUndoCustomGroup2(const Name: TRVUnicodeString);
procedure EndUndoCustomGroup2(const Name: TRVUnicodeString);

(introduced in version 18)

The recommended and most efficient way to group operations (to undo them in a single step) is:

Edit.TopLevelEditor.BeginUndoCustomGroup(OperationName);
Edit.TopLevelEditor.SetUndoGroupMode(True);
<operations>
Edit.TopLevelEditor.SetUndoGroupMode(False);

BeginUndoCustomGroup2 and EndUndoCustomGroup2 provide an alternative way to group operations. Call BeginUndoCustomGroup2, then operations you want to group, then EndUndoCustomGroup2 (with the same Name):

Edit.BeginUndoGroup2(OperationName);
<operations>
Edit.EndUndoGroup2(OperationName);

BeginUndoCustomGroup2 and EndUndoCustomGroup2 do the same work as BeginUndoGroup2 and EndUndoGroup2, but allows to give a custom name to this group of changes.

This way of grouping is less efficient and requires more memory, but it allows grouping operations performed in several table cells (for example, replacing all occurrences of text).

These methods require an unlimited undo buffer (UndoLimit must be equal to -1), otherwise they do nothing.

Unlike the first set of method (which must be called for TopLevelEditor), these method must be called for a root editor.

Calls of BeginUndoCustomGroup2..EndUndoCustomGroup2 may be nested, but it is not recommended. You can use BeginUndoGroup, BeginUndoCustomGroup, and SetUndoGroupMode inside BeginUndoCustomGroup2..EndUndoCustomGroup2, but not vice versa.

See also:

Undo in RichViewEdit