Modifying NSTableView cell data just prior to invoking field editor
Modifying NSTableView cell data just prior to invoking field editor
- Subject: Modifying NSTableView cell data just prior to invoking field editor
- From: "K. Darcy Otto" <email@hidden>
- Date: Thu, 30 Apr 2009 20:38:18 -0700
I have an NSTableView subclass that adds a few spaces to data from the
source when it is displayed. So:
Datasource for cell: "A" (1)
NSTableView displays: " A" (2)
Now, when the field editor is called, it edits (2), not (1). Fair
enough. But I need to edit (1). So, how do I do this? I see two
ways to do this:
Option 1: Implement the change in a field editor subclass, by
overriding -viewWillDraw:, and stripping any leading spaces. This
works, and is how I'm currently doing it, but there are a few
drawbacks. In particular, viewWillDraw: is called many, many times.
Should I be overriding another method? Is there anything that is
called once, just prior to the field editor being invoked? That would
be ideal.
Option 2: Moving the text displayed by the NSTableView to the right by
some way other than inserting spaces. This might be the best way,
alleviating the need for a custom field editor and editing the field
editor text prior to display. I'm not really sure how to do this
though.
Thanks.
_______________________________________________
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