Posts Tagged ‘tmemo’

Line number of the cursor in a TMemo

Monday, December 29th, 2008

source : http://www.festra.com

To determine which line number the cursor of a Memo component is in, you can use the Windows API function SendMessage. (*API = Application Programmr Interface)

In the example below, the integer variable LineNumber receives the line number that the cursor of Memo1 is in:

LineNumber :=
SendMessage(Memo1.Handle, EM_LINEFROMCHAR, Memo1.Selstart, 0);