Find the cursor position in a TMemo  

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

Tip accessed 711 times

 


Simply run this code:


 var
    Lpos,Cpos,LineLength:integer;
 begin
      Lpos := SendMessage(memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0);
      Cpos := SendMessage(memo1.Handle,EM_LINEINDEX,Lpos,0);
      LineLength := SendMessage(memo1.handle, EM_LINELENGTH, Cpos, 0);
      CPos := Memo1.SelStart-CPos;

      Label1.Caption:=IntToStr(Lpos);   		{Linea / Line}
      Label2.Caption:=IntToStr(Cpos);		{Columna / Column}
      Label3.Caption:=IntToStr(LineLength);	{Longitud de la linea / Long of line}
 end;