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: Fri, 16 Oct 2015 09:24:20 +0200
On Mon, Oct 12, 2015 at 4:19 PM, Richard Charles <email@hidden> wrote:
>
>> 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.
>
NSToolbar is not a view, it is a class designed to "provide the
mechanism for a titled window to display a toolbar just below its
title bar" (from the doc). I need to display the toolbar in different
place, that is why I need to use custom NSView (please correct me if I
am wrong...).
>> 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.
NSToolbarItem is not really a superview (it's not a view at all
AFAICT). And yes, I know the containing frame can be resized, but I
need to set the visual appearance of the button (or make it behave
like in NSToolbar).
>
> 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.
>
Still, I have no idea why the 22 vs 24px :/
/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