|
Example: Moving caret to the beginning of paragraph |
Top Previous Next |
|
This example shows how to move caret to the beginning of the ParagraphIndex-th paragraph 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: GoToParagraph(RichViewEdit1, 7); ParagraphIndex is zero-based. |