rvico TRichView Reference | How to...

...move the caret to the beginning or to the end of document in TRichViewEdit

Top  Previous  Next

The caret is always at the end of selection.

Selection can be changed using method TRichViewEdit.SetSelectionBounds.

Moving to the beginning:

var

  ItemNo, Offs: Integer;

...

ItemNo := 0;

Offs   := MyRichViewEdit.GetOffsBeforeItem(ItemNo);

MyRichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);

Moving to the end:

var

  ItemNo, Offs: Integer;

...

ItemNo := MyRichViewEdit.ItemCount-1;

Offs   := MyRichViewEdit.GetOffsAfterItem(ItemNo);

MyRichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);

See also:

TRichViewEdit.CurItemNo and OffsetInCurItem;

Example how to move caret to the beginning of paragraph.


TRichView © trichview.com