Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting TRadioButton to checked causes OnClick event

Tags:

delphi

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

like image 209
Tom Avatar asked May 18 '10 12:05

Tom


2 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;
end;
like image 197
kludg Avatar answered Sep 23 '22 19:09

kludg


 mybox.Tag := 666; 
 mybox.Checked :=true; 
 mybox.Tag := 0;

procedure myboxOnclick(Sender : TObject);
begin
if Tag = 0 then
//Do your thing
end;
like image 29
Mihaela Avatar answered Sep 23 '22 19:09

Mihaela