• 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: NSTableView - kill the blue (Obj-C)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView - kill the blue (Obj-C)


  • Subject: Re: NSTableView - kill the blue (Obj-C)
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 26 Jul 2015 10:17:39 -0500

On Jul 26, 2015, at 7:25 AM, 2551 <email@hidden> wrote:

> I’ve been struggling with NSTableView for the last two days. All I want to do is ensure the alternative “gray” highlight is used on a selection consistently instead of the heavy blue.

My first question is why do you want to trick your uses into seeing your table as being in a non-key window?  If you're going to use a non-standard selection highlight, you should use a different color entirely, one that doesn't have strong connotations already.


> I’ve seen SE posts suggesting subclassing NSTableRowView, but I don’t understand why, since the property setEmphasized already exists in the parent class and should work across the board (shouldn’t it??).

That setter is used by Cocoa itself to inform the row view whether it is emphasized (in the key window).  If you call it yourself, you have no guarantee (as you've seen) that your value won't be replaced by Cocoa at some point.

The right approach is to subclass NSTableRowView.  It's not hard.  Why do you resist it?

You could have your subclass override the emphasized property to always return false, but I'm not sure that's best.

You could also override -drawSelectionInRect:, which is precisely for customizing how the selection is drawn.  If you do that, you should also override -interiorBackgroundStyle to return an appropriate value (generally NSBackgroundStyleLight).  Otherwise, it will return NSBackgroundStyleDark for a selected and emphasized row, which will cause text fields to draw white.

Regards,
Ken


_______________________________________________

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:
    • NSPropertyListSerialization weirdness
      • From: Robert Martin <email@hidden>
    • Re: NSTableView - kill the blue (Obj-C)
      • From: 2551 <email@hidden>
References: 
 >NSTableView - kill the blue (Obj-C) (From: 2551 <email@hidden>)

  • Prev by Date: Re: WKWebView loading local files (and relative paths)
  • Next by Date: Re: NSTableView - kill the blue (Obj-C)
  • Previous by thread: NSTableView - kill the blue (Obj-C)
  • Next by thread: Re: NSTableView - kill the blue (Obj-C)
  • Index(es):
    • Date
    • Thread