Maybe I'm missing some things here, but hey; that's what I come to the
list for.
I'm not fully understanding the need for NSController's and/or what
they do.
Say I have an NSObject subclass:
---- (.h)
@interface TestObject : NSObject {
BOOL boolProp;
}
@property BOOL boolProp;
---- (.m)
@synthesize boolProp;
----
If I have an arbitrary checkbox, which I bind to MyObject.boolProp,
the connection works. I observe the property changing if the checkbox
is changed, and if, within code, I call self.boolProp = YES, the check
box changes.
However, once in a while, I'll have random problems that are fixed
with the addition of a mediating NSObjectController. For example, I
have a class WindowTwoController, which declares property IBOutlet id
graphView, which has the property BOOL isActive. I have a checkbox in
the window for one of these controllers bound to
myWindowTwoController.graphView.isActive
If, in the code for WindowTwoController, I call
self.graphView.isActive = NO, the checkbox does not change.
However, if I add an NSObjectController with content set to
myWindowTwoController, and bind the checkbox through that with the
selection key, then in my code for WindowTwoController:
[[self myObjectController] setValue:[NSNumber numberWithBool:NO]
forKeyPath:@"selection.graphView.isActive"];
then the check box is responsive.
What exactly is the magic that NSController performs? How come simple
bindings work without it?
Thanks for any replies!
_______________________________________________
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