Re: Pop Up Menu in NSTableView
Re: Pop Up Menu in NSTableView
- Subject: Re: Pop Up Menu in NSTableView
- From: Pax <email@hidden>
- Date: Mon, 25 Mar 2013 17:13:14 +0000
I'm going to try both types of table - but I need to find good documentation, preferably with examples, first. Right now, however, I've decided that this is useful future functionality, and not core to the software. So I've gone back to plan a - checkboxes in NSTableView (still need to work that out too, but it should be simpler), and I've put a load of extra code in to support the additional flexibility that I'd like to have in the future (so that I don't have to rewrite my plugins once I get this going just as I'd like).
I'm sorry to be such a wimp - but right now this is just 'too hard'.
Once I've worked out how the code will look, I'll drop you a personal email with the code that I used (rather than cluttering up this forum by resurrecting what will, by then, be an old thread).
On 25 Mar 2013, at 17:05, Jerry Krinock <email@hidden> wrote:
>
> 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
_______________________________________________
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