Re: Which field is the NSTextFieldCell drawing?
Re: Which field is the NSTextFieldCell drawing?
- Subject: Re: Which field is the NSTextFieldCell drawing?
- From: "K. Darcy Otto" <email@hidden>
- Date: Sun, 17 May 2009 09:08:15 -0700
Thank you. The thing is, the cell object returned by -
tableView:willDisplayCell:forTableColumn:row: is not from my
NSTextFieldCell subclass but rather the superclass – even though it is
the subclass doing the drawing. Any idea how to address the subclass
object directly?
On 17-May-09, at 6:38 AM, Jim Correia wrote:
On Sat, May 16, 2009 at 9:05 PM, K. Darcy Otto <email@hidden>
wrote:
I have an NSTextFieldCell subclass that needs to draw itself
differently
depending on which NSTableView row it is drawing. My current
solution is to
store the row that is being drawn in my document class in an instance
variable (the assignment is done in
-tableView:willDisplayCell:forTableColumn:row:), and have my
NSTextFieldCell
read out that variable prior to drawing itself. Is there a more
direct way
to do this? Is it possible to either:
(1) Have the NSTextFieldCell subclass look up the row that is
currently
being drawn, or
(2) Store the row to be drawn in an instance variable of the
NSTextFieldCell.
I think (1) would be the easiest. What is preventing (1) is that
I'm not
sure how to query the NSTableView to ask it what object is
currently being
drawn. What is preventing (2) is that I'm not sure how to get a
pointer to
the NSTextFieldCell subclass object that is about to be drawn, and
insert
the appropriate information just before it is drawn.
-tableView:willDisplayCell:forTableColumn:row: *is* your hook to do
this.
In that delegate method, set any additional properties on your cell
that you need at display time.
- Jim
_______________________________________________
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
_______________________________________________
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