Sergey Tkachenko Site Admin
Joined: 27 Aug 2005 Posts: 6576
|
Posted: Sun Aug 28, 2005 10:25 am Post subject: [Example] How to move caret to the paragraph |
|
|
A very simple example: how to move caret to the beginning of the n-th paragraph
| Code: | procedure GoToParagraph(rve: TCustomRichViewEdit; ParagraphIndex: Integer);
var i: Integer;
begin
for i := 0 to rve.ItemCount-1 do begin
if rve.IsParaStart(i) then
dec(ParagraphIndex);
if ParagraphIndex<0 then begin
rve.SetSelectionBounds(i, rve.GetOffsBeforeItem(i), i, rve.GetOffsBeforeItem(i));
rve.Invalidate;
exit;
end;
end;
end; |
Call:
| Code: | | GoToParagraph(RichViewEdit1, 7); |
ParagraphIndex is zero-based. |
|