VCL Delphi

Title: How to select a row in a Memo by clicking on it
procedure TfrmMain.Memo1Click(Sender: TObject);
var
Line: Integer;
begin
with (Sender as TMemo) do
begin
Line := Perform(EM_LINEFROMCHAR, SelStart, 0);
SelStart := Perform(EM_LINEINDEX, Line, 0);
SelLength := Length(Lines[Line]);
end;
end;