Undo/Redo Image

General TRichView support forum. Please post your questions here
Post Reply
Adz
Posts: 4
Joined: Fri Apr 08, 2016 10:07 am

Undo/Redo Image

Post by Adz »

RVE: v14.0.3
Delphi Seattle 10 U1

Any way to undo/redo inserted images to TRichViewEdit? I added image to rve using AddPictureEx.

I tried something like below to no avail:

Code: Select all

...
rve.TopLevelEditor.BeginUndoGroup(rvutInsert);
rve.TopLevelEditor.SetUndoGroupMode(True);
try
  rve.AddPictureEx(...);
finally
  rve.TopLevelEditor.SetUndoGroupMode(False);
end;
Thanks!
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

All methods marked in the help file as "viewer-style" methods cannot be undone. They are intended for fast document generation, not for editing operations.
Use InsertPicture instead of AddPictureEx.
Adz
Posts: 4
Joined: Fri Apr 08, 2016 10:07 am

Post by Adz »

Ahh InsertPicture works. Semantics? :)


Thank you.
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

All Add* methods add content to the end of the document.
They are designed to fast document generation, like:

Code: Select all

rv.Clear;
<calls to AddNL, AddPictureEx and so on>
rv.Format;
These methods cannot be undone.

Insert* methods insert in the caret position, they are designed to implement editing operations (the only exception is InsertRVFFromStream, its undoable alternative is InsertRVFFromStreamEd)

More explanations are here: http://www.trichview.com/help/viewer_vs_editor.html
Post Reply