On Jan 10, 2010, at 19:58, Jerry Krinock wrote:

> After studying some about bindings during the last week, I decided that, just 
> for fun, I would bind an NSSegmentedControl to its window controller using a 
> binding instead of target/action.  I thought that selectedSegment might be a 
> KVO-compliant property of NSSegmentedControl because it has a 
> -selectedSegment and -setSelectedSegment: method.
> 
> So I exposed a binding named @"foo" in my window controller's +initialize, in 
> -awakeFromNib I added this:
> 
>  [windowController bind:@"foo"
>                toObject:segmentedControl
>             withKeyPath:@"selectedSegment"
>                options:0] ;

Adding on to mmalc's response, to make this explicit:

You *didn't* "bind an NSSegmentedControl to its window controller", you 
actually bound a window controller['s "foo" binding] to [the "selectedSegment" 
property of] a NSSegmentedControl.

IIRC the bindings documentation isn't clear which direction "is bound to" 
refers to and/or it gives the impression that a binding is symmetric (which it 
may effectively be at the level of notifications, but it isn't at the level of 
establishing bindings between objects).


_______________________________________________

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