Checkbox doClick not working?

I got this code on my checkbox:

[lua]
chkClock.DoClick = function() error(‘You clicked the checkbox!’) end
[/lua]

And it’s doing nothing when i click away at my checkbox.

Try OnChange instead?

I think i tried that one too, but it didn’t do anything either.

Goz, try this first:

[lua]chkClock.DoClick = function() RunConsoleCommand(“kill”) end [/lua]

Doesn’t do anything.

Uh, well, I can’t see what you’re doing wrong there.

-Snip-

EDIT: I was incorrect

You should be using the onChange function (the doClick function is used for other things), and you also need to pass in the Panel object along with the function like so:


chkClock.OnChange = function( self ) error('You clicked the checkbox!') end

I just started using a convar because that one did work :stuck_out_tongue:

Yeah I was on my way telling you to use ConVar’s.