How to move cursor to checkpoint, if this checkpoint inside table cell?
.............
I run recurce scanner for cells bookmarks (your example Demos/Autoscan URL). And scan all bookmarks.
But I can not put cursor on cells bookmarks

Code: Select all
function ScrollToCheckpoint(rv: TCustomRichView; const CPName: String): Boolean;
function _ScrollToCheckpoint(RVData: TCustomRVFormattedData;
rv: TCustomRichView; const CPName: String): Boolean;
var i,r,c,x,y: Integer;
Tag: TRVTag;
CPD: TCheckpointData;
Name: String;
RI: Boolean;
table: TRVTableItemInfo;
begin
for i := 0 to RVData.ItemCount-1 do begin
CPD := RVData.GetItemCheckpoint(i);
if Assigned(CPD) then begin
RVData.GetCheckpointInfo(CPD, Tag, Name, RI);
if Name=CPName then begin
RVData.GetOriginEx(x,y);
rv.ScrollTo(y+RVData.GetCheckpointYEx(CPD));
Result := True;
exit;
end;
end;
if RVData.GetItemStyle(i)=rvsTable then begin
table := TRVTableItemInfo(RVData.GetItem(i));
for r := 0 to table.Rows.Count-1 do
for c := 0 to table.Rows[r].Count-1 do
if table.Cells[r,c]<>nil then begin
Result := _ScrollToCheckpoint(
TCustomRVFormattedData(table.Cells[r,c].GetRVData),
rv, CPName);
if Result then
exit;
end;
end;
end;
Result := False;
end;
begin
Result := _ScrollToCheckpoint(rv.RVData, rv, CPName);
end;
Code: Select all
function GoToCheckpoint(rv: TCustomRichViewEdit; const CPName: String): Boolean;
function _GoToCheckpoint(RVData: TCustomRVFormattedData;
rv: TCustomRichViewEdit; const CPName: String): Boolean;
var i,r,c,x,y: Integer;
Tag: TRVTag;
CPD: TCheckpointData;
Name: String;
RI: Boolean;
table: TRVTableItemInfo;
begin
for i := 0 to RVData.ItemCount-1 do begin
CPD := RVData.GetItemCheckpoint(i);
if Assigned(CPD) then begin
RVData.GetCheckpointInfo(CPD, Tag, Name, RI);
if Name=CPName then begin
RVData := TCustomRVFormattedData(RVData.Edit);
RVData.SetSelectionBounds(i, RVData.GetOffsBeforeItem(i), i, RVData.GetOffsBeforeItem(i));
Result := True;
exit;
end;
end;
if RVData.GetItemStyle(i)=rvsTable then begin
table := TRVTableItemInfo(RVData.GetItem(i));
for r := 0 to table.Rows.Count-1 do
for c := 0 to table.Rows[r].Count-1 do
if table.Cells[r,c]<>nil then begin
Result := _GoToCheckpoint(
TCustomRVFormattedData(table.Cells[r,c].GetRVData),
rv, CPName);
if Result then
exit;
end;
end;
end;
Result := False;
end;
begin
Result := _GoToCheckpoint(rv.RVData, rv, CPName);
end;