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: Keary Suska <email@hidden>
- Date: Thu, 26 Dec 2013 14:51:57 -0700
On Dec 26, 2013, at 10:49 AM, Peter Teeson wrote:
> The documentation in the NSCell Class Reference states:
> Designated Initializers
> When subclassing NSCell you must implement all of the designated initializers.
> Those methods are: init, initWithCoder:, initTextCell:, and initImageCell:.
>
> and later on
> Sets the receiver’s control tint.
> - (void)setControlTint:(NSControlTint)controlTint
> Parameters
> controlTint
> An Designated Initializers value that specifies the tint of the receiver.
Neither of these docs are necessarily relevant, as it may not be a function of the cell that determines its look. In fact, it is most likely the button that makes the decision.
> Changing the instantiation code to this makes no difference:
> _Cancel = [[NSButton alloc]init];
> [_Cancel setFrame:theButtonFrame];
> [_Cancel setNeedsDisplay:YES];
>
> So my questions are:
> (0) Is the fact that initWithFrame does not set the currentControlTint a bug (and hence worth a bug report)?
Why would it? There are a other factors that may effect the tint, and on top of that, the NSControlTint value of 0 is "NSDefaultControlTint" which would likely be the appropriate value if there is no other determinate condition.
> (1) It is not in the list of Designated Initializers - should it be?
What you quote above is NSCell's designated initializers, and the class has no direct relationship with NSButton other than both being subclasses of NSObject.
> (2) Other than sub-classing NSCellInit and NSButton what other code way can I set the controlTint for the Button?
If you need something other than the default, I imagine you are expected to set it yourself. You could always make a generic NSButton subclass that you can use in Interface Builder to see how various attributes are set.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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