trichview.com

trichview.support




Re: Moving the cursor


Return to index


Author

Message

Sergey Tkachenko

Posted: 11/15/2003 22:20:56


> Hi,

> 1. Is it possible to move the cursor to move the cursor, by coding, to the

> beginning (the start) of the paragraph. Similarly, is it possible to place

> the cursor after a certain item in RichViewEdit.


After the item:

rve.SetSelectionBounds(ItemNo, rve.GetOffsAfterItem(ItemNo), ItemNo,

rve.GetOffsAfterItem(ItemNo));


At the beginning of 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.




>

> 2. I click on a certain item in a paragraph. What is the best way to get

> the starting item(first item) in that particular paragraph.


var rve: TCustomRichViewEdit;

  FirstParaItemNo: Integer;


rve := RichViewEdit1.TopLevelEditor;

FirstParaItemNo := rve.CurItemNo;

while not rve.IsParaStart(FirstParaItemNo) do

  dec(FirstParaItemNo);








Powered by ABC Amber Outlook Express Converter