NSButtonCell in NSCell-based NSTableView & Bindings

148 views Asked by At

I have an NSButtonCell as data cell in one of my NSTableView's columns. The table view is cell-based and has two columns ; one with the button cell, one with a text field cell.

The button cell's respective column's target and argument are bound to my app delegate (as the target) and to the selectedObjects array of an NSArrayController (as the argument). Basically the same as what's outlined in one of Apple's Technical Q&As.

When I open the app, the table view is automatically populated. Everything works as expected. If I click a button my action method gets called just fine, and this method receives the selectedObjects as a parameter.

It's just not the functionality I want ; I'd like to get the object that is represented by the row of the clicked NSButtonCell instead of the currently selected objects (in my case this is an NSString as my NSArrayController is populated with strings).

Is it possible to get this particular object, only through bindings? Or should I, instead, set the selector of the NSButtonCell (the data cell) without bindings? And then get the object by using NSTableView's -clickedRow method?

0

There are 0 answers