Thanks Kyle and Graham for your comments.


Am I wrong about this interpretation of what I'm reading?

Yes, take a look at -setObjectValue:.  This point confused me for
ages.  You can bind the cell's value to whatever object you like, and
in -setObjectValue: extract the relevant information into ivars for
later use.


Great - thanks a lot for clearing that up. Let's just say the docs (including the guide) leave a little to be desired in terms of explaining how this works.

Please log a documentation bug requesting it to be clarified; this is good feedback, and we can make our docs better with proper bug reports.


More info can be had at this old page (Google cache because it's no
longer on kupuk.com):
http://74.125.45.132/search?q=cache:QhibCjcx2f0J:kupuk.com/2007/10/08/custom-nscells-with-nsmanagedobjects/+nscell+bindings

--Kyle Sluder


Very nice doc, thanks.

I now have a subclass of NSTextFieldCell that works as I'd expect. However, I thought I should probably be subclassing NSCell, but when I do this I get the message: [<NSTableColumn 0x1aec000> valueForUndefinedKey:]: this class is not key value coding-compliant for the key value.

...which came as something of a surprise.

Obviously, this suggests that something in the basic NSCell is trying to get a 'value' out of the NSTableColumn, unlike the NSTextFieldCell derived implementation. Nothing in my subclass implementation has changed other than the attempt to change the superclass to NSCell from NSTextFieldCell. Right now I'm only overriding -setObjectValue: and -drawInteriorWithFrame:inView: but this turn of events makes me think that some other method must be overridden if I have the basic NSCell as the superclass. Any ideas?

If you want to draw text, then it is generally better/easier to subclass NSTextFieldCell. I think it is a known issue that bindings don't work with a plain NSCell subclass --- again, please log a bug for this issue and we can investigate.

corbin
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to