On Jan 29, 2012, at 22:32 , Seth Willits wrote:

> The popup should display the names, but I want the selected item bound to 
> fileType which is one of the UTIs. By my reading of the documentation, this 
> _should be very simple_.
> 
> Bind:
> content -> fileTypes*
> contentValues -> fileTypeNames
> selectedObject -> fileType
> 
> 
> So content provides the list of objects, contentValues provides the 
> corresponding titles for each object, selectedObject determines which object 
> is selected. Sounds simple, never works. I've never been able to figure it 
> out. It seems that if contents provides an array of *strings*, those strings 
> are use as the titles *no matter what*.
> 
> The documentation for content says: "Unless contentValues is also bound, the 
> titles of the items in the NSPopUpButton are derived by invoking description 
> for each of the content objects," the documentation for contentValues says 
> "An array of strings that are displayed as the items in the NSPopUpButton,"  
> but no matter what on earth I try, it will not work. If I have content bound 
> to, say, an array of dictionaries, the popup uses contentValues to display 
> the titles.

I dunno, but I think the bindings should be like this:

content -> fileTypeNames
contentObjects -> fileTypes
selectedObject -> fileType

The issue of 'content' providing titles instead of 'contentValue' if it 
contains strings -- that sounds like a bug, or one of those bug-like design 
decisions.

If the documentation says 'content' should be an array controller, I'd be 
inclined to do it, but who can tell. If you just want to bind to an an array, 
you can bind to contentValues instead, and leave 'content' unbound (but in that 
case you don't get to bind 'contentObjects').


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to