Mega Code Archive

 
Categories / Delphi / VCL
 

Actual row and column in a memo field

Title: Actual row and column in a memo-field Question: With the internal message-system of the VCL you can get the actual row and column from a TMemo control. Answer: Use the OnKeyUp event via the object-inspector: procedure TForm1.Memo1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); var x: integer; begin x := Memo1.Perform(EM_LINEFROMCHAR,-1, 0) +1; Panel1.Caption := Inttostr(x) + ':' + IntToStr(Memo1.Lines.Count); end;