Link to home
Start Free TrialLog in
Avatar of mathematics
mathematics

asked on

the position of the cursor in TRichEdit

How can we get the position of the cursor in TRichEdit?
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi mathematics,

what does you mean?
the coordinates?
the Line?
the charindex?

which position?

meikl
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kotik
kotik

You can get the cursor position using CaretPos:

RichEdit1.CaretPos.X  // zero based char number in the line
RichEdit1.CaretPos.Y  // zero based line number

To get the absolute caret position use SelStart property
CharIndex := RichEdit1.SelStart;
hi kotik,

must be a d4 feature, i've d3 and there is no caretpos!

well, mathematics, if you use d4, then u can use kotiks suggestion, because it seems to me easier to implement. in this case reject my answer.

meikl
Avatar of mathematics

ASKER

meikl,Thanks. Maybe RichEdit1.CaretPos.X is the pixels (X,Y).
I will try.