rvico TRichView Reference | TRichViewEdit

TCustomRichViewEdit.BeginUndoGroup2, EndUndoGroup2

Top  Previous  Next

An alternative method to group operation for undo.

procedure BeginUndoGroup2(UndoType: TRVUndoType);
procedure EndUndoGroup2(UndoType: TRVUndoType);

(introduced in version 18)

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

Edit.TopLevelEditor.BeginUndoGroup(UndoType);
Edit.TopLevelEditor.SetUndoGroupMode(True);
<operations>
Edit.TopLevelEditor.SetUndoGroupMode(False);

BeginUndoGroup2 and EndUndoGroup2 provide an alternative way to group operations. Call BeginUndoGroup2, then operations you want to group, then EndUndoGroup2 (with the same UndoType):

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

BeginUndoGroup2 and EndUndoGroup2 do the same work as BeginUndoCustomGroup2 and EndUndoCustomGroup2, but gives a standard name (undo identifier) 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 BeginUndoGroup2..EndUndoGroup2 may be nested, but it is not recommended. You can use BeginUndoGroup, BeginUndoCustomGroup, and SetUndoGroupMode inside BeginUndoGroup2..EndUndoGroup2, but not vice versa.

See also:

Undo in RichViewEdit, includes an example.


TRichView © trichview.com