• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView's "data" binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSTextView's "data" binding
      • From: mmalc crawford <email@hidden>
References: 
 >NSTextView's "data" binding (From: Yann Bizeul <email@hidden>)
 >Re: NSTextView's "data" binding (From: mmalc crawford <email@hidden>)
 >Re: NSTextView's "data" binding (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: NSTask vs. special characters
  • Next by Date: Re: bindings, nested arrays and validation
  • Previous by thread: Re: NSTextView's "data" binding
  • Next by thread: Re: NSTextView's "data" binding
  • Index(es):
    • Date
    • Thread