procedure TForm1.Memo1Click (Sender: TObject);
begin 
  Text: = Format ('Current column:% d, current row:% d', [Memo1.CaretPos.X, Memo1.CaretPos.Y]);
end ;

// implemented with API
procedure TForm1.Memo1Click (Sender: TObject);
var
  LineY, LineX: Integer;
begin 
  LineY: = SendMessage (Memo1.Handle, EM_LINEFROMCHAR, Memo1.SelStart,0);
  LineX: = SendMessage (Memo1.Handle, EM_LINEINDEX, LineY,0);
  Text: =  'Current line:' + IntToStr (LineY) + ';'+                   // 0 start
          'Current column:' + IntToStr (Memo1.SelStart-LineX) + ';'+    // 0 start
          'Current character:' + IntToStr (Memo1.SelStart) + '.';           // include # 13 # 10
end ;



// Count word count

// Add Memo1, Label1, Label2, and Button1
procedure TForm1.Button1Click (Sender: TObject);
var 
  s:string ;
  i, sum, e, c, t: Integer;
begin
  s: = Memo1.Text;
  e: = 0;
  c: = 0;
  sum: = Length (s);

  for i: =0 to sumdo
  begin
    if (Ord (s [i])> =33) and (Ord (s [i]) <=126) then
    begin
      Inc (e);
      Label1.Caption: = 'Number of letters:' + IntToStr (e);
    end ;

    if Ord (s [i])> =127 then
    begin
      Inc (c);
      Label2.Caption: = 'Number of Chinese characters:' + IntToStr (c div 2);
    end ;
  end ;
end ;