1 2 procedure TForm1.Memo1KeyUp(Sender: TObject; var Key: Word;
3 Shift: TShiftState);
4 5 var6 x,y:integer; //integer to hold the x,y cordinates of cursor7 8 begin9 10 // gets the y cordinate from memo field11 y := SendMessage(Memo1.Handle, EM_LINEFROMCHAR, memo1.Selstart,0);
12 13 //calculates the x cordinate from memo field14 x:=memo1.Selstart-SendMessage(Memo1.Handle, EM_LINEINDEX, y,0)+1;
15 16 //displays information on form's caption bar17 Caption:='X:='+IntToStr(x)+' Y:='+intTostr(y);
18 19 end;