• 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: Creating NSButton in Code does not set controlTint to currentControlTint
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Creating NSButton in Code does not set controlTint to currentControlTint
      • From: Peter Teeson <email@hidden>
References: 
 >Creating NSButton in Code does not set controlTint to currentControlTint (From: Peter Teeson <email@hidden>)

  • Prev by Date: Re: Creating NSButton in Code does not set controlTint to currentControlTint
  • Next by Date: Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • Previous by thread: Re: Creating NSButton in Code does not set controlTint to currentControlTint
  • Next by thread: Re: Creating NSButton in Code does not set controlTint to currentControlTint
  • Index(es):
    • Date
    • Thread