Re: Pop Up Menu in NSTableView
Re: Pop Up Menu in NSTableView
- Subject: Re: Pop Up Menu in NSTableView
- From: Jerry Krinock <email@hidden>
- Date: Mon, 25 Mar 2013 10:05:09 -0700
First of all, I don't want to dissuade you from considering a view-based table as Quincey suggested, if that works for you.
As Quincey said, NSPopUpButtonCell can be used in tables. I've done it many times.
On 2013 Mar 24, at 13:47, Pascal Harris <email@hidden> wrote:
> cellPreferenceChanged is bound to the NSPopUpButtonCell in IB.
Echoing Quincey's questioning what you mean by that, you can't use Cocoa bindings on an action. Cocoa bindings are, in my experience, good to use with tables, but the bindings for a popup button cell are not obvious:
• NSTableColumn 'selected object' must be bound to 'arranged objects' of array controller. (This is always true, regardless of what the cell type is.)
• For dynamic menu contents, NSPopupButtonCell 'content' may be bound to an object and key path which returns an array containing objects which are assignable to the 'selected object'.
• NSPopupButtonCell 'content values' may be bound to an array giving the strings you want displayed in the table, by appending an additional key onto the key path which 'content' is bound to. The additional key must be a method which which can be sent to the objects in the array that 'contents' is bound to, and return a string.
I'd be curious to know if you find the view-based table easier than this. Maybe I should learn to do it that way.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden