Author: Tomas Rutkauskas
I was wondering if there was any way to change the state of the TCheckBox control
without setting off the OnClick Event Handler. If certain other properties are
incorrect, I want void the state the event was set to by the Click, without setting
of the event handler again.
Answer:
1 procedure TForm1.Button1Click(Sender: TObject);
2 begin3 if Button1.Tag = 0 then4 begin5 SendMessage(CheckBox1.handle, BM_SETCHECK, BST_CHECKED, 0);
6 Button1.Tag := 1;
7 end8 else9 begin10 SendMessage(CheckBox1.handle, BM_SETCHECK, BST_UNCHECKED, 0);
11 Button1.Tag := 0;
12 end;
13 end;
14 15 procedure TForm1.CheckBox1Click(Sender: TObject);
16 begin17 Showmessage('clicked');
18 end;