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: Uli Kusterer <email@hidden>
- Date: Fri, 27 Dec 2013 01:01:27 +0100
On 26 Dec 2013, at 18:49, Peter Teeson <email@hidden> wrote:
> _Cancel = [[NSButton alloc]init];
> [_Cancel setFrame:theButtonFrame];
> [_Cancel setNeedsDisplay:YES];
Several issues here:
1) Control tints only apply to window widgets, focus borders, token capsules and to Aqua UI. MacOS X 10.7 removed the last aqua buttons and replaced them with grey, tint-less buttons. So whatever tint you set, you won’t see it anymore these days. Those grey, tint-less buttons look very similar to some other button types these days.
2) When you create a new NSButton, it is by default set up to look like a NeXT-style button. You need to set its bezel to NSRoundedBezelStyle to get a Mac-style button. NeXT-style buttons don’t honour the tint either. So the code you posted isnot identical to the button you create in IB. Hence, even if you’re running on 10.6 or earlier where buttons still show the tint, it’s not surprising that your button looks different.
3) As others mentioned, buttons are usually set to “default”. To find out what that corresponds to, look at NSColor’s currentControlTint method.
Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de
_______________________________________________
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