Page 1 of 1

Undo/Redo Image

Posted: Fri Apr 08, 2016 10:20 am
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!

Posted: Fri Apr 08, 2016 1:24 pm
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.

Posted: Fri Apr 08, 2016 2:00 pm
by Adz
Ahh InsertPicture works. Semantics? :)


Thank you.

Posted: Fri Apr 08, 2016 2:04 pm
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