Binding to custom NSCell
Binding to custom NSCell
- Subject: Binding to custom NSCell
- From: Ken Tozier <email@hidden>
- Date: Wed, 11 Feb 2009 04:58:36 -0500
Hi
I created a custom NSCell subclass, defined accessors for stringValue,
setStringValue, objectValue ane setObjectValue. I set the data cell
for a column like so:
[column setDataCell: customCell];
And bind the column to an array controller:
[column bind: @"value" toObject: controller withKeyPath:
@"arrangedObjects.name" options: nil];
When I run my app, I get a crash with the following error:
An uncaught exception was raised
[<NSTableColumn 0x13f880> valueForUndefinedKey:]: this class is not
key value coding-compliant for the key value.
Which I found rather odd because the exact same binding works when the
cell type is an NSTextFieldCell
I then explicitly defined "value" and "setValue" accessor for the
cell, and got the exact same crash and error message. I Googled and
found this thread "http://lists.apple.com/archives/Cocoa-dev/2006/Jan/msg00646.html
" but it just seemed to go off on a bunch of tangents without stating
the solution.
Clearly, Apple is doing something in their predefined NSCell
subclasses to supply values that is not immediately clear from reading
(and reading and reading and reading...) the documentation
So in simple terms, how do I supply the info required by the bind
method of a table column? Exact assessor names don't work. Exact
property names don't work. What's the secret?
Thanks for any help
_______________________________________________
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