Using Field Editor correctly in custom NSCell
Using Field Editor correctly in custom NSCell
- Subject: Using Field Editor correctly in custom NSCell
- From: Graham Cox <email@hidden>
- Date: Wed, 23 Jun 2010 11:56:28 +1000
I have a custom cell that displays a text label, which can be edited. The code for this custom cell is something I found on the net already written - I'll protect the guilty by not saying whose it is, but the text editing part doesn't work correctly, so I need to fix it. What happens is that the editing functions to a degree but the text attributes don't match what is drawn by the cell - the font is much bigger.
I've read the field editor documentation and I'm pretty OK with the concept, but when coding a custom cell it's not that clear exactly what should and should not be implemented in the delegate, and what is merely optional.
For example, it seems that the cell should override -setUpFieldEditorAttributes: but what should this method actually do? In the cell code I have, this method has been commented out, and the field editor "set up" is being done in -editWithFrame:inView:editor:delegate:event: (and the same set up is repeated in the -selectWithFrame:... method). Clearly this is wrong since it doesn't work. However, if I uncomment the -setUpFieldEditorAttributes: method, it's no better - at first the text is the right size but reverts to the bigger font when I type, and at the end of editing the field editor doesn't go away as it should, so the label is just overdrawn with a blank white box.
I'm prepared to just go through and rework the entire text editing/delegate methods of the cell as necessary but what I need is a clear indication of what has to be overridden and what has to be done in those overrides. Pointers to relevant documentation or example code that works properly would be gratefully received.
thanks,
--Graham
_______________________________________________
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