trichview.com

trichview.support.examples




Example: moving caret to the paragraph


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/19/2002 14:07:21


A very simple example: how to move caret to the beginning of n-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));

        exit;

      end;

    end;

  end;


Call:

   GoToParagraph(RichViewEdit1, 7);


ParagraphIndex is zero-based.





Powered by ABC Amber Outlook Express Converter