Position of the cursor into a TMemo

 



Procedure TForm1.Memo1Change ( Sender : TObject ) ;

Var

   LinePosition , ColumnPosition , LineLength : integer ;

Begin

   LinePosition := SendMessage ( memo1.Handle , EM_LINEFROMCHAR , Memo1.SelStart , 0 ) ;

   ColumnPosition := SendMessage ( memo1.Handle , EM_LINEINDEX , LinePosition , 0 ) ;

   LineLength := SendMessage ( memo1.handle , EM_LINELENGTH , ColumnPosition , 0 ) ;

   ColumnPosition := Memo1.SelStart - ColumnPosition ;

   caption := '' ;

   Caption := 'Line  ' + Caption + IntToStr ( LinePosition ) ;

   Caption := Caption + '  Column  ' + IntToStr ( ColumnPosition ) ;

   Caption := Caption + '  Length  ' + IntToStr ( LineLength ) ;

End ;


Back Home Foward