• 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: Quincey Morris <email@hidden>
  • Date: Thu, 26 Dec 2013 15:44:35 -0800

On Dec 26, 2013, at 09:49 , Peter Teeson <email@hidden> wrote:

> Sets the receiver’s control tint.
> - (void)setControlTint:(NSControlTint)controlTint
> Parameters
> controlTint
> An Designated Initializers value that specifies the tint of the receiver.
>
> Changing the instantiation code to this makes no difference:
>    _Cancel = [[NSButton alloc]init];
>    [_Cancel setFrame:theButtonFrame];
>    [_Cancel setNeedsDisplay:YES];

This looks like a documentation editing error. There’s no such thing as a “designated initializers value”. Forget about designated initializers.

On Dec 26, 2013, at 15:08 , Peter Teeson <email@hidden> wrote:

> Simply put.  all I wish to do is instantiate an NSButton in code and have it present the Aqua colour when pressed and not the Graphite.

So you showed this code:

> _Cancel= [[NSButton alloc]initWithFrame:theButtonFrame];
>
>    NSString *tintImageName;
> if ([NSColor currentControlTint] == NSGraphiteControlTint)
>    tintImageName=@"GraphiteImage";
> else
>    tintImageName=@"AquaImage"; // This is the currentControlTint
>
>    NSString *cellTintText;
>    NSControlTint cellTint = [_Cancel.cell controlTint];
> if ( cellTint == NSBlueControlTint)
>    cellTintText = @"AquaTint";
> else
>    cellTintText = @"GraphiteTint"; // This is the cell controlTInt

but you forget to say what (if anything) goes wrong with *this* code. If you’re trying to force the button to aqua, there should be a ‘setControlTint: NSBlueControlTint’ and no ‘if’s, shouldn’t there?

Incidentally, I see in the OS X 10.1 release notes that there wasn’t originally a separate value for graphite. That’s not true any more. This fact may imply that the default behavior when creating controls isn’t especially logical, for compatibility reasons. Explicitly setting the desired tint may be the correct thing to do. I dunno.

_______________________________________________

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>)
 >Re: Creating NSButton in Code does not set controlTint to currentControlTint (From: Keary Suska <email@hidden>)
 >Re: 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: Creating NSButton in Code does not set controlTint to currentControlTint
  • 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