trichview.com

trichview.support




Re: caret position


Return to index


Author

Message

Sergey Tkachenko

Posted: 09/13/2002 23:11:30


You can set caret to the


- specific item;

Document consists of items, indexed from 0 to editor.ItemCount.


Moving caret to the beginning of the 5th item:


editor.SetSelectionBounds(5, editor.GetOffsBeforeItem(5),

  5, editor.GetOffsBeforeItem(5));

editor.Invalidate;


- specific 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;


There are no methods for moving caret to the specified line on screen (if

"line" is a text row  from the left side of window to the right side).

Such lines depend on word wrapping, and text may be divided on lines

differently if user changes window size.



>

> how can I set the caret in a specific line.

> tanks

>





Powered by ABC Amber Outlook Express Converter