Re: Creating NSButton in Code does not set controlTint to currentControlTint
Re: Creating NSButton in Code does not set controlTint to currentControlTint
- Subject: Re: Creating NSButton in Code does not set controlTint to currentControlTint
- From: Peter Teeson <email@hidden>
- Date: Fri, 27 Dec 2013 13:39:07 -0500
On 2013-12-27, at 12:31 AM, Kyle Sluder <email@hidden> wrote:
> On Thu, Dec 26, 2013, at 07:08 PM, Peter Teeson wrote:
>> [_Cancel setBezelStyle:NSShadowlessSquareBezelStyle];
> Ah. I think I've found (part of) your problem.
> NSShadowlessSquareBezelStyle does not and to my knowledge has never
> supported tinting with the user's tint color.
>
> To my knowledge, the only bezel styles that respect the system's tint
> color are NSRoundedBezelStyle and NSRoundedDisclosureBezelStyle, in
> addition to buttons whose buttonType is NSSwitchButton or NSRadioButton.
>
> But for the sake of completeness, I wrote a demo app that created a
> button with the NSRoundedBezelStyle. It responds correctly to the tint
> color setting in System Preferences, but it does NOT obey any tint color
> set programmatically via -setControlTint:. I don't know if this is a new
> behavior in Mavericks, or if this is true on earlier operating systems.
>
> Given the existence of NSAppearance on Mavericks, I would not be
> surprised if this is a regression that only happens on 10.9. But since
> the expected behavior works Out Of The Box(TM) by default, I wouldn't be
> surprised if nobody's noticed—or if Apple would actually consider this
> regression an improvement.
>
> --Kyle Sluder
Kyle Thanks for taking time to explore this.
The reason I was using NSShadowlessSquareBezelStyle is that in a matrix I had set the prototype cell to have that style.
That matrix is a subclass of NSMatrix and I also subclassed NSCell. All works as desired for that case.
BUT, and here's a big difference. Those matrix cells have my created images set for Off and Alternate states.
Whereas my earlier test code in the original post showed me, in the debugger, that the NSButton images were null.
The docn for Using System Tint showed code using images for the Clocks. IIRC there was a sample code project for the Clocks.
I'm hoping I don't need to set an Aqua Tint image for the Alternate image. Ideally it should "just work".
Anyway my next step is to follow up on Keary's suggestion as well as follow in your footsteps
by making a demo project to explore the precise difference between an IB button and my attempt at coding one.
I'll post here when I have some results worth sharing.
Thanks to everyone for responding to help me with this supposedly simply task.
respect…
Peter
_______________________________________________
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