Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
- Subject: Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
- From: Jacek Oleksy <email@hidden>
- Date: Sun, 11 Oct 2015 23:07:05 +0200
On Fri, Oct 9, 2015 at 5:21 PM, Richard Charles <email@hidden> wrote:
>
>> On Oct 9, 2015, at 7:41 AM, Jacek Oleksy <email@hidden> wrote:
>>
>> HI All,
>> I am creating custom toolbar and placing some buttons in it. I want it
>> to look as close to native toolbar as possible (and no, sadly I cannot
>> use NSToolbar).
>
> Are you subclassing NSToolbar? NSToolbarItem has a view property that you can set to use NSButton if you wish. This can be done programmatically but not sure how to do it in Interface Builder (Xcode).
I am not subclassing NSToolbar, I am using NSView (and putting
NSButton as a subview).
>
>> The problem is that when I put NSButton on the custom toolbar with
>> NSTexturedRoundedBezelStyle, its height is 22 pixels. However, if a
>> button like this is put on NSToolbar, it gets a height of 24 pixels.
>
> Programmatically you can set the button height to what ever you want.
Sadly, that is not true. From the documentation on NSTexturedRoundedBezelStyle:
"A textured (metal) bezel style similar in appearance to the Finder’s
action (gear) button. The height of this button is fixed."
Setting programatically the height does nothing.
>
>> Anyone has a clue what is going on here? Does button is somehow aware
>> that it is put in NSToolbar and changes its appearance?
>
> I have noticed that Apple has tweaked the “standard” height of some controls over the years (at least I think that is the case). It is probably more common for a toolbar item to have an image not a button. It may be that Apple is trying to force compliance to a guideline in this regards. But the height of a button should not matter as long as visually it is what you want and displays properly.
>
> When trying to duplicate the look and feel of some controls found in Apple applications be aware that you might not get there using default values. I think this is especially true in toolbars.
>
The problem can be seen after creating a new project in XCode, adding
toolbar and putting a button on it (with proper style) and then
putting another button on the view. The height differs (24px vs 22px).
/Jacek
_______________________________________________
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