Binding CoreData Managed Object to NSTextFieldCell subclass
Binding CoreData Managed Object to NSTextFieldCell subclass
- Subject: Binding CoreData Managed Object to NSTextFieldCell subclass
- From: Nial Giacomelli <email@hidden>
- Date: Thu, 20 May 2010 15:07:46 +0100
I have an NSTableView which has its first column set to contain a custom
NSTextFieldCell. My custom NSTextFieldCell needs to allow the user to edit a
"desc" property within my Managed Object but to also display an "info"
string that it contains (which is not editable). To achieve this, I followed
this tutorial (
http://www.timisted.net/blog/archive/custom-cells-and-core-data/). In a
nutshell, the tutorial suggests editing your Managed Objects generated
subclass to create and pass a dictionary of its contents to your
NSTableColumn via bindings.
This works well for read-only NSCell implementations, but I'm looking to
subclass NSTextFieldCell to allow the user to edit the "desc" property of my
Managed Object. To do this, I followed one of the articles comments, which
suggests subclassing NSFormatter to explicitly state which Managed Object
property you would like the NSTextFieldCell to edit. I've posted the code of
my NSFormatter subclass here (http://pastebin.org/257930) for reference.
This seems to work, but is extremely patch. On occasion, clicking to edit a
row will cause its value to nullify. On other occasions, the value you enter
on one row will populate other rows within the table.
I've been doing a lot of reading on this subject and would really like to
get to the bottom of this. What's more frustrating is that my
NSTextFieldCell is rendering exactly how I would like it to. This editing
issue is my last obstacle! If anyone can help, that would be greatly
appreciated.
_______________________________________________
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