Q:  I want to write a simple application that converts numbers from hex to decimal. My form has two edit boxes, one for the decimal number and another for the hex number.  I add some code to each edit box's OnChange handler and as I type in one, the other updates in real time. The problem I am wondering about, is this. The OnChange for one, changes the edit box text in the other, firing the OnChange in that one, which in turn updates the other and fires its OnChange and so on ad infinitum.

A:  One solution would be to do nothing in the OnChange event handler unless ActiveControl is equal to the control that is calling the event handler.

    procedure TForm1.Edit2Change(Sender: TObject);
    begin
     if ActiveControl = Edit2 then
        Edit1.Text := IntToHex(StrToInt(Edit2.Text),0);
    end;

    procedure TForm1.Edit1Change(Sender: TObject);
    begin
     if ActiveControl = Edit1 then
        Edit2.Text := IntToStr(StrToInt('$'+Edit1.Text));
    end;

Options:  Instead of OnChange. Use OnKeyDown. This way 1 Keydown equates to 1 loop as you intend.