views:

121

answers:

1

Take a look at the top pane of the Xcode window.

There's a table list, with checkboxes in one of the columns. That's the interface I want to do.

So how do you nest a button in an NSTableView cell?

+2  A: 

You need to set the data cell of the column to an NSButtonCell. In IB you can simply drag a checkbox cell (not a checkbox button!) to the column to assign it.

Wevah
Perfect! Thank you. I'm finding the only two things I can drag these cells into are Table View and Matrix -- is that accurate?
For the most part, yeah. Anything that logically could accept any kind of cell should be able to accept them.
Wevah
The IBAction triggered by the button is passing the Table View object not the button -- is that normal? Maybe it's because the whole row in my table is getting selected currently when the button is clicked? I can work around it but would be nice to be able to get the button's on/off state.
Yes, it's normal. The control is the table view.What you should be doing is updating your model via the `tableView:setObjectValue:forTableColumn:row:` data source method, and doing any side-effects there.
Wevah
(Or using bindings.)
Wevah
OK I see that IBActions shouldn't be used then...
Well, you might be able to get away with them, if you check the `-clickedRow` and `-clickedColumn` of the table sending the action…though I usually do the stuff in the data source methods.
Wevah