Re: Odd binding issue
Re: Odd binding issue
- Subject: Re: Odd binding issue
- From: "Timothy Reaves" <email@hidden>
- Date: Fri, 12 Mar 2004 10:13:25 -0500 (EST)
>
On Mar 11, 2004, at 10:54 PM, T Reaves wrote:
>
>
> Hello all.
>
>
>
> I have a simple app that uses manual bindings. It has several text
>
> fields and text views. One of the text views binds an NSTextView like
>
> so:
>
> // bind itemDescription
>
> [bindingOptions setObject:@"No Description"
>
> forKey:@"NSNullPlaceholder"];
>
> [itemDescription bind:@"string" toObject:itemController
>
> withKeyPath:@"selection.description" options:bindingOptions];
>
>
>
OK, as an aside...
>
>
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)
>
--snip--
>
>
So you'd want to bind it to value (which takes an NSString, but is
>
only available when the NSTextView is set to single font mode.)
>
>
> [itemDescription bind:@"value" toObject:itemController
>
> withKeyPath:@"selection.description" options:bindingOptions];
>
>
>
Anyways.. the problem you're seeing is that selection.description is
>
not a method that Item seems to implement, so you're getting the basic
>
-description result stuck in there..
>
Well, I had originally used @"data", but that does not work. I
always get an error 'Cannot create NSData from object This is an item
description', where "This is an item description" is what [item
description] would return. As to using @"value", I think you might
need to check your sources. 'Uncaught exception:
<NSUnknownKeyException>[<NSTextView 0x346f40> valueForUndefinedKey:]:
this class is not key value coding-compliant for the key value.'
So neither value or data works. The key string DOES work, just not
that first time. As I (tried) stated, I have two other NSTextView
bound with string that do not display this behavior.
_______________________________________________
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.