Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
- Subject: Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
- From: Richard Charles <email@hidden>
- Date: Mon, 12 Oct 2015 08:19:06 -0600
> On Oct 11, 2015, at 3:07 PM, Jacek Oleksy <email@hidden> wrote:
>
> I am not subclassing NSToolbar, I am using NSView (and putting
> NSButton as a subview).
Why would you not use NSToolbar? I would bet that Apple “native” toolbars use NSToolbar or a subclass there of.
> 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.
I have a NSTexturedRoundedBezelStyle button in a toolbar (actually as Jens pointed out a NSToolbarItem that displays a button).
The height of my button is 22 points. If I programmatically set the height to 60 points the button’s position shifts vertically by half that amount in the tool bar. You are right that the graphics or image of the button does not change. When the documentation states that “the height of this button is fixed” I think that really means that visually the height of the image is fixed. But the frame height of the button can be use to adjust the vertical position of the button with respect to it’s superview which is a NSToolbarItem.
Several years ago when this was fresher in my mind I believe I was also struggling with the 24pt vs 22pt height. Perhaps this is Apple’s way of adjusting the vertical position of the button image within the superview.
--Richard Charles
_______________________________________________
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