Page 1 of 1

Help With UnDo

Posted: Mon Jan 03, 2011 8:16 pm
by andyhill
Hi, I cannot undo lines added by code below:-

rve.BeginUpdate;
rve.BeginUndoGroup(rvutMiscTyping); // Tried everything ???
rve.SetUndoGroupMode(True);

rve.AddNL('', CurTextStyleNo, CurParStyleNo);

rve.CurTextStyleNo:= TextStyleNo;
rve.CurParaStyleNo:= ParStyleNo;
rve.AddNL(DateStr, TextStyleNo, ParStyleNo);

rve.CurTextStyleNo:= CurTextStyleNo;
rve.CurParaStyleNo:= CurParStyleNo;
rve.AddNL('', CurTextStyleNo, CurParStyleNo);

rve.SetUndoGroupMode(False);
rve.EndUpdate;

// Paint (will not show unless we ReFormat ???)
rve.ReFormat;

Posted: Tue Jan 04, 2011 8:58 pm
by Sergey Tkachenko
Some methods (like AddNL) were designed for quick creation of new documents. They cannot be undone.
Some methods were designed for editing operations. They can be undone.
Please read http://www.trichview.com/help/viewer_vs_editor.html

Posted: Tue Jan 04, 2011 9:11 pm
by Sergey Tkachenko
PS: Reformat is not correct after AddNL, Format is required.
But for an editing operation, AddNL should be changed to InsertText, and Format is not needed.