Mega Code Archive

 
Categories / Delphi / Examples
 

Getmemolineno

RETRIEVE THE LINE NUMBER OF THE CARAT IN A MEMO OR RICHEDIT COMPONENT Richard Nov '98 Example waits 'til user has clicked and released the mouse (the click should put the carat in the line where the mouse is clicked, so if we wait for the mouseUp event we can be sure that the carat is there and not where it was) procedure TREForm.LinesMemoMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var lineNumber: longInt; begin lineNumber := SendMessage(REForm.LinesMemo.Handle, EM_LINEFROMCHAR, -1, 0); Inc(lineNumber); end;