Function MouseDown(X As Integer, Y As Integer) As Boolean
if X>3 and X<16 and Y>5 and Y <18 then
select case me.State
case CheckBox.CheckedStates.Checked
me.State = CheckBox.CheckedStates.UnChecked
case CheckBox.CheckedStates.UnChecked
me.State = CheckBox.CheckedStates.Indeterminate
case CheckBox.CheckedStates.Indeterminate
me.State = CheckBox.CheckedStates.Checked
end
end if
return true
End Function
I check the values of X and Y to make sure the user clicks within the box. Otherwise a click anywhere in the checkbox label would change the state.
In the past, checkboxes had two states. Maybe when they implemented Indeterminate, they forgot to change the click change. I believe it is a bug, though.
Indeed, in the standard UI the state changes when clicked on the text, but not on the transparent part of the label. The workaround can be modified to accomodate that. Luxury solution calls for measuring the size of the text with StringWidth and add that to the tested max value of x. A quick fix can simply be to increase the max value of it approximatively.