Re: Binding Target of NSButtonCells inside of an NSTableView
Re: Binding Target of NSButtonCells inside of an NSTableView
- Subject: Re: Binding Target of NSButtonCells inside of an NSTableView
- From: Tim Lucas <email@hidden>
- Date: Fri, 17 Jun 2005 13:29:19 +1000
On 17/06/2005, at 6:14 AM, Clark Cox wrote:
I have an NSTableView that is populated via bindings. So far, so good,
the correct data is displayed, etc. However, one of the columns has
NSButtonCell as its dataCell. I simply want a click in one of these
buttons to call a method on the model object backing it's row.
Currently, in IB, I have the binding on the table column set like so:
"target" is bound to <the NSArrayController>.selection, with a
selector of "selectFilename:"
"argument" is also bound to <the NSArrayController>.selection.
However, clicking any of the buttons in this column does nothing. My
method isn't called, I get no console messages, etc. Setting up a
NSButton outside of the table, with the same bindings gets my method
called. Is there some trick to that makes binding button cells in a
table view somehow different than binding freestanding buttons?
You should be binding to arrangedObjects rather than selection, just
like you do a textfield.
If there's no argument to the method, you just have to set up the
binding as follows:
Target:
Bind to: MyArrayController
Controller Key: arrangedObjects
Selector Name: myMethod
Remember also to bind to the table column, not the the button cell.
- tim lucas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden