(sender:Tobject) - I don't get it.

I thought I understood sender. Please explain the following:


A form with a radiogroup with 2 items.
A button on the form which sets the radiogroup to the first item.

I am trying to have the program work out where the change to the
radiogroup came from so I'm checking the value of "sender" on the
radiogroup click.

The actual code is:

procedure TForm1.Button1Click(Sender: TObject);

procedure TForm1.RadioGroup1Click(Sender: TObject);
     if sender=activecontrol then messagebeep(0);


I am expecting to receive a beep only when I click on radiogroup and NOT
when I click on button.

I press the radiogroup items: no beeps.
I press the button: no beep.

I Changed to this:

procedure TForm1.RadioGroup1Click(Sender: TObject);
     if sender=radiogroup1 then messagebeep(0);

It beeps every time even if I press the button.

What am I missing?

Bernard Hill
Braeburn Software
Author of Music Publisher system
Music Software written by musicians for musicians
Selkirk, Scotland
01750 21854
+44 1750 21854