Re: [NSTableview] can't make selected text stay black
Re: [NSTableview] can't make selected text stay black
- Subject: Re: [NSTableview] can't make selected text stay black
- From: Keith Blount <email@hidden>
- Date: Fri, 12 Mar 2010 17:48:38 -0800 (PST)
Actually, after testing this, does overriding NSCell's -highlightColorWithFrame:controlView: really have the same effect as overriding the _highlightColorForCell: private message? I assume the latter just calls the former, but I must be doing something wrong because overriding -highlightColorWithFrame: didn't have the desired effect for me. Please see the following demo project:
http://www.literatureandlatte.com/misc/BlackSelectedTableText.zip
Note that in that simple project, MyTextFieldCell overrides -highlightColorWithFrame:controlView: to return nil (and there is an NSLog in there to ensure it is getting called), but although doing so prevents the highlight colour from getting drawn, the text still gets drawn in white (even though the -willDisplayCell: delegate method in MyDocument is setting it to black). Contrast this with uncommenting the _highlightColorForCell: method that returns nil in MyTableView, which has the desired effect of ensuring the text gets drawn in black (which is what the op was after and is the reason I ended up resorting to this private message).
Am I missing something obvious? Is there something else that needs to be used in conjunction with this to force the text to be drawn in black even when highlighted? (To put this in context, I use NSOutlineView to provide an OmniOutliner-style outline with a light blue selection, so the text needs to be black even when highlighted given the light highlight, which is custom-drawn.)
Many thanks and all the best,
Keith
----- Original Message ----
From: Corbin Dunn <email@hidden>
To: Keith Blount <email@hidden>
Cc: email@hidden; email@hidden
Sent: Fri, March 12, 2010 11:29:08 PM
Subject: Re: [NSTableview] can't make selected text stay black
>
> P.S. I'm hesitant about mentioning private methods here, but I don't think there's another way of doing it - I filed an enhancement request for this method to be made public back in April '06, ID#4521167, so please do the same if you think it would be useful. I'm CC'ing Corbin so he can straighten me out on the private method thing if this is totally the wrong advice, but it works for me. :)
Thank you for logging the bug -- I do realize we could make this better. Currently, there is a way to do it (override highlightColorWithFrame:), so adding the requested method is "nice to have", but not essential.
corbin
_______________________________________________
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