PDA

View Full Version : Detecting NSButtonCell clicks inside an NSTableView




rand0m3r
Oct 26, 2007, 07:44 AM
I have an NSTableView which has NSButtonCell as one of the three columns. I don't have a problem with setting the value of the switch/checkbox (on or off) but I don't know how to detect the checkbox being clicked in the first place.

It seems like mouseEntered: is the closest thing, but I'm not sure how I'm suppose to use it. Is there any form of notification or delegate?



kainjow
Oct 26, 2007, 08:03 AM
I'd suggest reading How Controls and Cells Interact (http://developer.apple.com/documentation/Cocoa/Conceptual/ControlCell/Concepts/ControlsAndCells.html), especially the second paragraph.

What are you trying to accomplish by checking for when this value has changed? You could also just use KVO (http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/Overview.html).

rand0m3r
Oct 26, 2007, 04:30 PM
each row of the table is basically a record/object of my model. so when there is a click in the box, i want to change the model to reflect that.