• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTextFieldCell editing text that is an attribute of the bound object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextFieldCell editing text that is an attribute of the bound object


  • Subject: NSTextFieldCell editing text that is an attribute of the bound object
  • From: Luke Evans <email@hidden>
  • Date: Fri, 30 Jan 2009 21:32:49 -0800

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 (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


  • Follow-Ups:
    • Re: NSTextFieldCell editing text that is an attribute of the bound object - EVIL HACK
      • From: Luke Evans <email@hidden>
  • Prev by Date: Re: Determining Previous Front Process
  • Next by Date: Re: NSPredicateEditorRowTemplate and NSTokenField
  • Previous by thread: Re: NSOperationQueue bug with leopard 10.5.6?
  • Next by thread: Re: NSTextFieldCell editing text that is an attribute of the bound object - EVIL HACK
  • Index(es):
    • Date
    • Thread