Re: NSTextView's "data" binding
Re: NSTextView's "data" binding
- Subject: Re: NSTextView's "data" binding
- From: Yann Bizeul <email@hidden>
- Date: Mon, 30 Apr 2007 00:04:30 +0200
Hello,
Now I see different documentations on how to implement bindings in
custom views (includng your GraphicsBindings) and I'm a bit confused/
disappointed :
In almost every examples I saw, it seems that I have to implement KVO
myself in
- (void)bind:(NSString *)bindingName
toObject:(id)observableObject
withKeyPath:(NSString *)observableKeyPath
options:(NSDictionary *)options
but I thought NSObject was KVO compliant so that when I
willChangeValue / didChangeValue, it was responsabile of annoucing
the chages to every observers, automatically setup in
bind;toObject:withKeyPath:options: implementation of NSObject.
I see another method here : http://www.bignerdranch.com/palettes/
x342.htm involving NSObject's infoForBinding:
Right now without implementing anything but KVC, my NSView handles
changes made in objects bound to it, but objects bound to it do not
receive changes.
That means its KVC accessors are called, (does that means it
automatically registered as an observer for such keys ?) but changes
made in the view are not propagated to my model objetcs (but I'm KVO
complient)
I hope you can put some light on this, I'm not sure if I have to keep
track of observers myself or not, which seem to be quite an overhead
to me.
Best regards,
Yann Bizeul • yann at tynsoe.org
Cocoa Developer
Tynsoe Projects
BuddyPop • GeekTool • SSH Tunnel Manager • ...
http://projects.tynsoe.org/
Le 28 avr. 07 à 17:48, mmalc crawford a écrit :
On Apr 28, 2007, at 8:29 AM, mmalc crawford wrote:
Moreover, you should almost certainly be binding to an
intermediary controller (an instance of a subclass of
NSController) and not directly to the managed object.
Thinking about this a little more, assuming
[self bind:@"data" toObject:textView withKeyPath:@"data"
options:nil];
is in a method of an NSManagedObject subclass, you should also review:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html>
There should be no reason for a model object to have a text view as
an instance variable.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden