I want to remove the "nearest" checkpoint - meaning the nearest checkpoint going "backwards", but not beyond the current paragraph.
Code: Select all
function TForm1.CheckPointNumber(rve: TCustomRichViewEdit): Integer;
var
i: Integer;
begin
Result := -1;
rve := rve.TopLevelEditor;
i := rve.CurItemNo;
while not rve.IsParaStart(i) do
begin
if rve.RVData.GetItemCheckpoint(i) <> nil then
begin
Result := i;
exit;
end;
dec(i);
end;
if rve.RVData.GetItemCheckpoint(i) <> nil then
Result := i;
end;
Code: Select all
procedure TForm1.miRemoveCheckpointClick(Sender: TObject);
begin
if Self.CheckPointNumber(rve) > -1 then
begin
rve.RemoveCheckpointEd(CheckPointNumber(rve));
//rve.Invalidate;
end;
end;
Thanks