http://stackoverflow.com/questions/2857235/setting-tradiobutton-to-checked-causes-onclick-event

 
Join the Stack Overflow Community
 
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other. 
Join them; it only takes a minute: 
Sign up
mybox.Checked := true;

Setting TRadioButton to checked (by code) causes OnClick event handler to be called.

How can I recognize if user is making the state change by GUI interaction

shareimprove this question
 

3 Answers

You can nil the OnClick event handler while changing a radiobutton state programmatically:

procedure TForm1.Button6Click(Sender: TObject);
var
  Save: TNotifyEvent;

begin
  Save:= RadioButton2.OnClick;
  RadioButton2.OnClick:= nil;
  RadioButton2.Checked:= not RadioButton2.Checked;
  RadioButton2.OnClick:= Save;