On Mar 13, 2009, at 9:42 AM, Ivy Feraco wrote:

Hello everybody

Bindings problem:

I have an NSArrayController subclass and an NSPopUpButton subclass.
I am trying to bind the NSPopUpButton's selected object to the selection of my array controller.
I have to do this manually for reasons I won't get into here.

But when I do this (self is myPopUpButton)
[self bind:@"selectedObject" toObject:ArrayController withKeyPath:@"selection" options:nil];

I get the error that my array controller is not KVC for the key path selection. "selection" is definitely a controller key option in Interface Builder, is it possible that this doesn't work programmatically?
Has anyone else run into this problem???

I want to bind to the selected object, not the index... so it seems my only option here is selectedObjects, which I will have to pass an array of one object to.


Even if you didn't get the error, this approach wouldn't work. The selectedObject must be an exact object from the content collection. - selection returns a proxy object. You might try barking up using selectedValue instead. But then, you might still have the binding error, or it might go away since you are binding through selection. Anyway, have you verified that the ArrayController variable is what you expect it to be at the point that bind: is called?

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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