Help With UnDo

General TRichView support forum. Please post your questions here
Post Reply
andyhill
Posts: 28
Joined: Tue May 23, 2006 8:22 pm

Help With UnDo

Post 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;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply