Should click event handler

Actually there’s no ‘should click’ event handler for buttons :cry: !
How can I manage this? :
There’s a check box in a table column that is checked. The user should not be able to uncheck but must be able to select the table row.

I tried following but failed:

on clicked theObject
if someValidationCode then
set contents of data cell "checkBox" of selected data row of table view "bestList" of scroll view "bestList" of winMain to true
-- I thought, this should set the state of the check box back to 'checked', but doesn't

Some ideas?


Ahhh…from experience grows wisdom. :smiley:

Thanks for clarifying Jon.

No, he’s got the right syntax when a checkbox formatter is used in a table. This formatter will be “checked” when the contents are true and unchecked when the contents are false. The thing to do to keep the user from changing this is to add the checkbox formatter to your column in IB then double-click the column and then click the triangle in the top right corner of the column header cell. This will allow you to set the formatter properties from the Attributes pane of Info Palette (the palette title should be NSButtonCell Info). You can uncheck the enabled property and this will essentially keep the user from being able to modify the value of the cell. In your code you can set the contents of that cell to true or false to check it or uncheck it accordingly.

For more information you can take a look at my Checkbox_Cells demo project:


well, it’s not the best way to check/uncheck a check box by clicking other bottons than the check box it’s self. I found another solution for my issue:
I connected a clicked handler to the table view and entered the code that sets the value of the check box of the selected row depending on some validations. It’s not the best way too, but it works and the user can click the check box.

Thanks for advice!

The point of the demo app is to show the code, not the buttons. Of course using the buttons is not the way to go but the code behind it should be useful in showing how to manipulate the checkbox cells from a script.

Glad it helped.