[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'StdCtrls' (#lcl)

# TCustomEdit.CaretPos

The position of the editing cursor in the control.

## Declaration

Source position: stdctrls.pp line 861

`public property TCustomEdit.CaretPos : TPoint read GetCaretPos write SetCaretPos;`

## Description

CaretPos is a TPoint property which contains the coordinates for the caret (or editing cursor) in the control. The coordinates reflects logical (UTF-8) characters and lines.

TPoint.X
  Contains the zero-based offset into the UTF-8-encoded characters in the control Text. Position 0 is immediately prior to the first UTF-8 character in Text. If there is selected text in the control, the caret is considered to be positioned right after the last selected character. Character positions are independent of the LTR/RTL BiDi-ness for the control.
TPoint.Y
  Contains the zero-based relative line number for the editing cursor. For single-line edits the value is normally 0.

The value in CaretPos is updated by the widgetset class when key and selection control messages are handled.