Cabbage Logo
Back to Cabbage Site

How to uncheck a checkbox after it is being pressed

I want to uncheck a checkbox and its associated channel when its value is set to 1, so it immediately goes back to 0.

I have come up with this (full code is in the attachment):
if kcheckbox == 1 then chnset kcheckbox, "0" chnset "value(0)", "TurnOff" endif

However, this solution only works for as long as I press a note (and it goes back to 1 after the key is released) but I want to have it disabled right after setting it to 1.
Of course it does not make much sense in this context why I would want to set a checkbox to 0 right after the user sets it to 1 but I have another condition on top of that and I guess only this is causing me the problem.
checkbox.csd (758 Bytes)

You just need to put the checkbox code in an always on instrument (see attached).
checkbox.csd (763 Bytes)
bye,
Iain