Page 1 of 1

problem with checkpoint - add

Posted: Fri Feb 10, 2012 5:27 pm
by alexandreq
Hello sergey

I did this code to create several checkpoints.

var
str : string;
Editor : TDBSRichViewEdit;
begin
PegaEditor(Editor); // get the active editor
str := Editor.RichViewEdit.GetSelTextW;
if str='' Then Begin
ShowMessage('No word to create checkpoint');
end else begin
if Editor.RichViewEdit.CanChange Then Begin
Editor.RichViewEdit.AddNamedCheckpoint(Str);
Editor.RichViewEdit.Format;
Qtextos.Post;
end;
CarregaCheckPoint; // procedure Load CheckPoints into a listbox
end;

I am having the following problem:

1) I can only create one checkpoint
2) My text isn't being save with checkpoint created.

Why?

Thanks

Posted: Sat Feb 11, 2012 7:02 am
by Sergey Tkachenko
1) A checkpoint mark a position in the document. It cannot mark a selected fragment or any range of text.
2) AddNamedCheckpoint adds a checkpoint to the end of the document.

I recommend using InsertCheckpoint, GetCheckpointAtCaret, RemoveCheckpointAtCaret methods. They are editing methods, so you do not need CanChange, Format. Post is optional, if you want to save changes to DB immediately.