The Cocoa docs seem silent on how to achieve this.

I have an NSTextFieldCell subclass that gets sent an object from bindings. The reason for sending it an object is that I want the cell to display a number of the object's attributes - which it does nicely through custom drawing.
Now I need to allow editing of the text in the cell.  I have overridden:
editWithFrame:inView:editor:delegate:event:
and its buddy:
selectWithFrame:inView:editor:delegate:start:length:

These bring up the text editor nicely. However, as I have an object at the cell, I need to present a string to this mechanism (the name property of my object), and similarly I need to somehow obtain the value from the editor when editing has finished. At the moment, the default behaviour has the editor coming up with placeholder text, and when editing is finished I get an KVC error, e.g.: Error setting value for key path of object <MyClass: 0x1b385c0> (...) from bound object <NSTableColumn: 0x1b1ab20>(null)): [<MyClass 0x1b385c0> setValue:forUndefinedKey:]: the entity MyClass is not key value coding-compliant for the key .

Does anyone know how to wire up the editing so that I can provide initial text to the editor and prevent whoever it is from attempting to set the final value directly onto the bound object (which it clearly doesn't know how to do as it's a particular attribute of the object at the cell)?




_______________________________________________

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