[Example] How to move caret to the paragraph
Posted: Sun Aug 28, 2005 10:25 am
A very simple example: how to move caret to the beginning of the n-th paragraph
Call:
ParagraphIndex is zero-based.
Code: Select all
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;
Code: Select all
GoToParagraph(RichViewEdit1, 7);