Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

TEdit: Find character at caret position

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jürgen Hestermann

In a TEdit component, how do I find out which character is at the caret/cursor position? Or in other words: At which (string) position will the next typed character be inserted? I want to insert text at just that position myself but cannot find out where this (character) position would be.

Any help appreciated.

Reply by email

Howard Page-Clark
to Jürgen Hestermann
J?rgen Hestermann wrote 6 lines
In a TEdit component, how do I find out which character is at the caret/cursor position? Or in other words: At which (string) position will the next typed character be inserted? I want to insert text at just that position myself but cannot find out where this (character) position would be.

Edit1.SelStart gives the character position of the caret/cursor. The next typed character is inserted at Succ(Edit1.SelStart).

Howard

---
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Jürgen Hestermann
to Howard Page-Clark
Howard Page-Clark wrote 9 lines
On 02/08/2015 18:33, J?rgen Hestermann wrote: > In a TEdit component, how do I find out which character is at the > caret/cursor position? > Or in other words: At which (string) position will the next typed > character be inserted? > I want to insert text at just that position myself but cannot find out > where this (character) position would be. Edit1.SelStart gives the character position of the caret/cursor. The next typed character is inserted at Succ(Edit1.SelStart).

Sure? I thought SelStart gives the start of the selected text, not of the cursor.

Reply by email