bindings best practices
bindings best practices
- Subject: bindings best practices
- From: Derrek Leute <email@hidden>
- Date: Sat, 28 Oct 2006 14:27:15 -0400
I have a button who's (when did buttons become who?) enabled binding
is bound to selection.canAddNew of an NSTreeController. This works
great.
however if I do this:
[self bind:@"testToAdd" toObject:treeController
withKeyPath:@"selection.canAddNew" options:nil];
I get gibberish back not canAddNew when I log the result in testToAdd
(and I change the selection in my NSOutlineView). The documentation
clearly states that selection returns a proxy object. Does that mean
bindings set through interface builder are doing behind the scene
magic like:
[[[treeController selectedObjects] objectAtIndex: 0] canAddNew];
Doesn't this mean that my bound method (accessor set) needs to have
an understanding of NSObjectController classes and use the above
selectedObjects code to get the value?
It seems like I must be missing something when creating bindings
programatically.
Is there a better way to get the same behavior as IB through code? Or
should I just observe selection or selectedObjects and then use the
above code to get the actual object?
--Derrek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden