On Fri, Oct 9, 2015 at 5:21 PM, Richard Charles <rcharles...@gmail.com> wrote: > >> On Oct 9, 2015, at 7:41 AM, Jacek Oleksy <jole...@opera.com> 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com