I would have thought that a check box "OnClick" would require an actual mouse click but apparently it simply requires a status change. This makes some sense since a user could also alter the state of a check box by tabbing to it and pressing the space bar.
Here is a script to demonstrate. Roughly once per second the check box will be checked or unchecked by the program. There is an adddialoghandler function for the check box's OnClick event. Each time the check box's status is changed, the OnClick event will be triggered and a message box with a counter will open. If the word "True" at the end of Line 40 is changed to "False", the check box state will no longer change and the OnClick event will not be triggered.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
object CheckBox1: TCheckBox
Left = 50
Top = 100
Width = 97
Height = 17
Caption = 'CheckBox1'
TabOrder = 8
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,OnCLose,Quit
AddDialogHandler>Dialog1,checkbox1,OnClick,Report
Let>RepCount=0
SRT>Report
Add>RepCount,1
Message>RepCount
END>Report
SRT>Quit
Exit>0
END>Quit
Show>Dialog1
Let>kk=0
Label>Loop
Wait>0.01
Add>kk,1
Let>test={%kk% mod 100}
If>test=0
GetDialogProperty>Dialog1,checkbox1,Checked,res
If>res=True
SetDialogProperty>Dialog1,checkbox1,Checked,False
Else
SetDialogProperty>Dialog1,checkbox1,Checked,True
EndIf
EndIf
Goto>Loop