Re: How to change highlight colour on NSTableView row
Re: How to change highlight colour on NSTableView row
- Subject: Re: How to change highlight colour on NSTableView row
- From: Darren Wheatley <email@hidden>
- Date: Tue, 22 Oct 2013 13:36:27 +0100
Hi,
Thanks for the reply.
I tried the code sample you suggested but can't get it to work.
When running the default highlighting is being layered on top of this custom highlighting (I can see part of the custom highlighting where the rects are not quite overlapping). Do you know how I prevent the standard formatting from being displayed?
Also, (might be a symptom of the above) the custom highlighting is not always removed when I click on a new row. If I scroll those rows off the screen and back on the highlighting is fixed, so there is some sort of display refresh problem.
I have tried standard and source list highlighting (set in the xib), and both display the same behaviour.
Do you know what might be going on here, or anything I should check in my code? Any suggestions you could make would be very much appreciated.
FYI, I am developing on 10.8.5 and targeting 10.7.
Regards
Darren.
On 21 Oct 2013, at 17:23, <email@hidden> wrote:
> On 21 Oct 2013, at 16:19, Darren Wheatley <email@hidden> wrote:
>
>> Hi,
>>
>> I have a custom subclass of NSTableView in my app.
>>
>> Can anyone suggest a method that will allow me to set a custom highlight colour on on a row when the user clicks on it?
>>
>> I've Googled for a solution, but haven't been able to find anything that works.
>>
>>
> For cell based tables try:
>
> - (void)highlightSelectionInClipRect:(NSRect)clipRect
>
> There is a sample implementation at http://stackoverflow.com/questions/7038709/change-highlighting-color-in-nstableview-in-cocoa.
> You may need to set selectionHighlightStyle to NSTableViewSelectionHighlightStyleSourceList
>
> Note: This method should not be subclassed or overridden for a view-base table view. Instead, row drawing customization should be done by subclassing NSTableRowView.
>
> Jonathan
>
>
> _______________________________________________
>
> 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