Selecting a line in a TMemo by clicking it  

Send By: Q3 Team
Web : http://www.q3.nu
Email: dlib@q3.nu
Date: 25/12/99

Tip accessed 572 times

 


Put this code into OnClick event of the TMemo:


 procedure TForm1.Memo1Click(Sender: TObject);
 var
   Linea:integer;
 begin
   with (Sender as Tmemo) do
   begin
     Linea:= Perform(EM_LINEFROMCHAR,SelStart,0);
     SelStart := Perform(EM_LINEINDEX, Linea, 0);
     SelLength:=Length(Lines[Linea]);
   end;
 end;