• 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
Re: Which field is the NSTextFieldCell drawing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 22:48:10 -0700

Hi Jim. You were right; there was a problem with how I was setting up the table column for my cell subclass. It turned out that my subclass was only returned for certain columns in my table (by design), and so I needed to distinguish between columns before calling methods in that subclass. Thanks,

Darcy

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


References: 
 >Which field is the NSTextFieldCell drawing? (From: "K. Darcy Otto" <email@hidden>)
 >Re: Which field is the NSTextFieldCell drawing? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: refreshObject throws for object no longer in database
  • Next by Date: Re: LMSetKey[Rep]Thresh
  • Previous by thread: Re: Which field is the NSTextFieldCell drawing?
  • Next by thread: new NSTreeController bug in 10.5.7?
  • Index(es):
    • Date
    • Thread