• 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: Highlight color of a NSTableView row
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Highlight color of a NSTableView row


  • Subject: Re: Highlight color of a NSTableView row
  • From: Eric Gorr <email@hidden>
  • Date: Thu, 10 Apr 2008 20:41:22 -0400


On Apr 10, 2008, at 8:28 PM, Corbin Dunn wrote:

If you're targeting Leopard, there is an NSTableView method you can override for this (a public one!)

-(void)highlightSelectionInClipRect:(NSRect)theClipRect

Ideally this should be the only method you have to override for Tiger also. You may have to coordinate with the cell (or use a custom cell) to get the cell to not draw a conflicting highlight (hence, that is why some people say to override _highlightColorForCell: -- this color isn't used by NSTableView -- it is used by the cell)

The only information I am displaying in the cells is text and, for one column only, a NSImage. Does this mean I can avoid using a custom cell?


How would I go about coordinating with the cell?

You have to actually draw the highlights, it's not simply a matter of setting the color. If you look at the post Ben linked to, there is sample code you can download that will show you what to do.


The problem I am having with this is that it is leaving white spaces between the columns, which correspond to where the grid lines would be - I have them turned off. Is there anything I can do about that?



NSRect aRowRect = NSInsetRect([self rectOfRow:aRow], 2, 1);

Your insetting the width and height, hence you get spacing.

I'm insetting the rect of the entire row...there shouldn't be any spaces between the columns, just some extra space left at the beginning and end of the row.


_______________________________________________

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


  • Follow-Ups:
    • Re: Highlight color of a NSTableView row
      • From: Corbin Dunn <email@hidden>
References: 
 >Highlight color of a NSTableView row (From: Eric Gorr <email@hidden>)
 >Re: Highlight color of a NSTableView row (From: Ben Lachman <email@hidden>)
 >Re: Highlight color of a NSTableView row (From: Cathy Shive <email@hidden>)
 >Re: Highlight color of a NSTableView row (From: Eric Gorr <email@hidden>)
 >Re: Highlight color of a NSTableView row (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: Highlight color of a NSTableView row
  • Next by Date: Re: Highlight color of a NSTableView row
  • Previous by thread: Re: Highlight color of a NSTableView row
  • Next by thread: Re: Highlight color of a NSTableView row
  • Index(es):
    • Date
    • Thread