Re: NSTableColumn not usable with binder of class NSTextValueBinder?
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
- Subject: Re: NSTableColumn not usable with binder of class NSTextValueBinder?
- From: Dave Dribin <email@hidden>
- Date: Fri, 22 Aug 2008 00:55:41 -0500
On Aug 21, 2008, at 12:45 AM, Ken Ferry wrote:
The NSTextValueBinder error message is a bug? Or the fact that
NSCell does
not have a "value" binding? Or both? ;)
Maybe both.. I meant the first.
Well, more information. I found the code that was directly
responsible for causing the error. It was in some code that was
posing as NSTableView (no, I didn't write it, and I now plan to
replace it :), so it was well hidden and I didn't even know it existed.
It turns out calling [column infoForBinding:@"value"] can cause that
error message and an exception to be thrown. In this case, I was
binding to a column with a text field cell setup in IB, but then
changing the cell in code in awakeFromNib. Calling infoForBinding: on
this column, after changing the cell, gives that error. From what you
said about IB doing text cell specific binding stuff, this isn't
overly surprising. So maybe this is not quite a bug after all, as
it's more of a "hey, this isn't a text cell, you dummy". Though maybe
the error message could be a bit more helpful?
I meant that you should call bind:toObject:withKeyPath:options:
yourself rather than relying on IB to do it.
But that's exactly what I am doing. I've got no bindings on the
column in IB, and in awakeFromNib, I'm calling bind:toObject:... on
the table column. I don't call it on the cell. I'm assuming the
table column passes the binding along to the cell somehow. It seems
that "value" can be bound to a NSTableColumn only for certain cells
(NSActionCell and subclasses)? Does the table column special case
NSActionCell?
Here's a stack trace when binding to "value" of a cell that is a
direct NSCell subclass. "self" at #3 is an NSTableColumn:
2008-08-22 00:16:08.540 CellBinder[69717:10b] [<NSTableColumn
0x101ed80> valueForUndefinedKey:]: this class is not key value coding-
compliant for the key value.
2008-08-22 00:16:08.540 CellBinder[69717:10b] *** Terminating app due
to uncaught exception 'NSUnknownKeyException', reason:
'[<NSTableColumn 0x101ed80> valueForUndefinedKey:]: this class is not
key value coding-compliant for the key value.'
#1 0x901690fb in objc_exception_throw ()
#2 0x962dac71 in -[NSException raise] ()
#3 0x94d03ea3 in -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] ()
#4 0x94bfb69b in _NSGetUsingKeyValueGetter ()
#5 0x94bfb1aa in -[NSObject(NSKeyValueCoding) valueForKey:] ()
#6 0x94c28d2a in -[NSObject(NSKeyValueCoding) valueForKeyPath:] ()
#7 0x90af02da in -[NSObjectParameterBinder
_updateObject:observedController:observedKeyPath:context:] ()
#8 0x90af0048 in -[NSObjectParameterBinder
_observeValueForKeyPath:ofObject:context:] ()
#9 0x90aefe77 in -[NSBinder _performConnectionEstablishedRefresh] ()
#10 0x90ae80e8 in -[NSObject(NSKeyValueBindingCreation)
bind:toObject:withKeyPath:options:] ()
#11 0x000022e5 in -[CellBinder_AppDelegate awakeFromNib]
(self=0x1035680, _cmd=0x90232928) at /tmp/CellBinder/
CellBinder_AppDelegate.m:20
#12 0x962e9955 in -[NSSet makeObjectsPerformSelector:] ()
#13 0x908fbbe6 in -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] ()
#14 0x908f1e12 in loadNib ()
#15 0x908f1774 in +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] ()
#16 0x908f13b7 in +[NSBundle(NSNibLoading)
loadNibFile:externalNameTable:withZone:] ()
#17 0x908f12f5 in +[NSBundle(NSNibLoading) loadNibNamed:owner:] ()
#18 0x908f0fa4 in NSApplicationMain ()
#19 0x000021f0 in main (argc=1, argv=0xbffff7c8) at /tmp/CellBinder/
main.m:13
-Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden