Re: Odd binding issue
Re: Odd binding issue
- Subject: Re: Odd binding issue
- From: Allan Odgaard <email@hidden>
- Date: Fri, 12 Mar 2004 22:10:20 +0100
On 12. Mar 2004, at 7:17, Scott Anguish wrote:
itemDescription is the NSTextView, and you're trying to set a binding
called string on it??
there is no binding called string for NSTextView. (excuse the
formatting, it's from something else)
Actually there is -- you can bind to any key-value-coding compliant
property. But the behavior will not be exactly the same as when binding
to one of the binding properties exposed by the view objects.
To clarify, if you do:
[textView bind:@"string" toObject:model withKeyPath:@"title"
options:nil];
Then each time you change the 'title' property (through KVC methods) in
the model, the text view will receive a ;setValue:newValue
forKey:@"string"+, which translates to setString: defined in the NSText
superclass.
If you instead do:
[textView bind:@"value" toObject:model withKeyPath:@"title"
options:nil];
Then you get the same as above, but additionally, when the text in the
text view changes (and editing is "done", i.e. most often when focus
leave the text view), the text view will send a setValue:forKey: to the
model object with the new text as value and @"title" as key -- this
latter behavior is not present when binding to normal key-value-coding
compliant properties.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.