Checkpoint navigation
Checkpoint navigation
Can you send example of code:
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
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
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I have examples for Delphi:
Example 1:
Example 2:
Update 2012-02-28: modified for compatibility with TRichView 13.4+
Example 1:
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;
Last edited by Sergey Tkachenko on Tue Feb 28, 2012 12:28 pm, edited 2 times in total.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Scroll
Sergey, thank you for this example. This code works fine for TRichViewEdit , but TRichView can't scroll on Cell.Edit()
Can you help for Viewer (scroll to table cell / bookmark)?
Can you help for Viewer (scroll to table cell / bookmark)?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Thanks
I try to test this code, thanks.
Samples
Ok, this code works Fine!
-
- Posts: 36
- Joined: Tue Aug 21, 2007 4:47 am
Re: Checkpoint navigation
Hi,
The above ScrollToCheckpoint routine will bring the checkpoint into view, sometimes at the bottom of the visible area. How can I make ScrollToCheckpoint bring the checkpoint to the middle of the visible area?
Thanks
Rael
The above ScrollToCheckpoint routine will bring the checkpoint into view, sometimes at the bottom of the visible area. How can I make ScrollToCheckpoint bring the checkpoint to the middle of the visible area?
Thanks
Rael
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Checkpoint navigation
In the today's update, GoToCheckpoint procedure from RichViewActions.pas has a new parameter ScrollToCenter: Boolean.