On Apr 19, 2011, at 8:46 PM, Ben Golding wrote:

> I should have been more specific.  What I have looks like:
> 
> popupButton.content -(Transformer)-> [arrayController].arrangedObjects
> popupButton.selectedIndex --> [arrayController].selectionIndex
> 
> I have also tried:
> 
> popupButton.contentValues -(Transformer)-> [arrayController].arrangedObjects
> popupButton.selectedIndex --> [arrayController].selectionIndex

You can't bind contentValues without also binding content, and contentValues 
should be bound to something "within" the content binding.  (That is, the 
binding should be the same as for content except perhaps with additional 
elements to its model key path.)

> In both cases, the transformer is passed an _NSControllerArrayProxy object 
> which wasn't what I was hoping for; I had hoped for an NSString.  I could 
> probably dredge around in that object and find some methods to use but all 
> the docs say "don't use undocumented methods/classes" so my gut reaction is 
> to try another way.

Have you tried setting a model key path?  How about "description"?

People often try binding, via array controllers, to arrays of values, and then 
want those values represented in the view.  It is my experience that bindings 
work better with arrays of objects, with a property of each object to be 
represented in the view.

In other words, an array of strings is often problematic, whereas an array of, 
for example, People objects, which have a "name" property which is a string, 
works better.

You can pretend the former case is more like the latter by using a model key 
path like "description" or even "self", although the latter case still tends to 
be more amenable to bindings.

Regards,
Ken

_______________________________________________

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

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

Reply via email to