Delphi tips :

Line number of the cursor in a TMemo

 
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);

 

DelphiLand Club Members of the DelphiLand Club receive our Crash Course Delphi, plus the fully commented source code of numerous projects, plus guaranteed answers from our Delphi Forum. Membership is for life!

TOP   DelphiLand Club Membership  DC Library  Forum  Forum Archives  Crash Course Delphi  Tips  Source Code  Downloads  Links