EControl Syntax Editor SDK
TCustomSyntaxMemo.CaretPos Property

Indicates the position of the caret in the memo lines.

property CaretPos: TPoint;

Use CaretPos to determine the caret coordinates in Lines.

  • X specifies zero-based caret position in the current line.
  • Y specifies zero-based index of the current line.

CaretPos.Y can not be greater or equal to Lines.Count. If Lines is empty, CaretPos.Y will be 0. 

CaretPos.X is any non-negative integer value. If Options contains soKeepCaretInText, CaretPos.X can not be greater than length of the current line, that is

     CaretPos.X < Length(Lines[CaretPos.Y])


To determine the position of the caret in terms of characters of text only (rather than X/Y location), use the CaretStrPos property.

Copyright (c) 2004-2011. All rights reserved.
What do you think about this topic? Send feedback!