[Solved] NSButton in NSToolbarItem does not use "small size"
[Solved] NSButton in NSToolbarItem does not use "small size"
- Subject: [Solved] NSButton in NSToolbarItem does not use "small size"
- From: Michael Starke <email@hidden>
- Date: Tue, 26 Feb 2013 19:27:46 +0100
Well then. After experimenting with different cells and buttons, I came up with the following findings:
If one uses a NSPopupButton in a NSToolBarItem the internal call (_handleSendControlSize:toCellOfView:) dispatches a setControlSize to the cell of the NSPopupButton. On the other hand, if one uses a NSButton, the NSButtonCell does not get the setControl call.
Weirdly, if I change the Cell of a NSButton to a NSPopupButtonCell, it gets called with setControlSize: and resizes accordingly
The solution to my problem was that NSToolBarItem seems to decide based on the cell class, whether to forward the call to the cell or just the containing view.
I then subclassed NSButton and added a setControlSIze that just forwards everything to the NSButtonCell and everything is fancy as the NSToolbarItem calls _handleSendControlSize:toView: with get's to my NSButton subclass. Problem solved. I do however not know, why in IB the NSButton does get resized. A neater solution would have been to persuade NSToolBarItem to just call the cell of a NSButton as it does with the NSPopupButton
--Michael
On 26.02.2013, at 17:32, Michael Starke <email@hidden> wrote:
> No, I did not, I'll try subclassing NSButtonCell and see what I can dig up.
>
> Thanks.
>
> --Michael
>
> On 26.02.2013, at 17:04, Keary Suska <email@hidden> wrote:
>
>> On Feb 26, 2013, at 8:28 AM, Michael Starke wrote:
>>
>>> Sorry for digging this up again.
>>>
>>> As I'm no experienced developer I'm somewhat lost how to address the situation.
>>> Is there a way to compare an NSToolbarItem with a NSButton created in IB to a one created programmatically?
>>>
>>> If so, this might shine some light as to what is really going on.
>>> While trying to figure out what happens I wrapped NSToolbarItem in a Proxy object to get all it's calls but it seems that I cannot get a hold of any resizing that is sent to the button's cell
>>
>> Working with the NSToolbarItem is not likely useful. Did you try my suggestion of subclassing NSButtonCell? You can certainly configure the button in IB then inspect its configuration for settings. Basically just size and font, I imagine. Then as long as you can capture the setControlSize: call either to the button or cell, you can resize the button appropriately.
>>
>> HTH,
>>
>> Keary Suska
>> Esoteritech, Inc.
>> "Demystifying technology for your home or business"
>>
>
>
> ___m i c h a e l s t a r k e____
> geschäftsführer
> HicknHack Software GmbH
> www.hicknhack-software.com
>
> ___k o n t a k t____
> +49 (170) 3686136
> email@hidden
>
> ___H i c k n H a c k S o f t w a r e G m b H____
> geschäftsführer - maik lathan | andreas reischuck | michael starke
> bayreuther straße 32
> 01187 dresden
> amtsgericht dresden HRB 30351
> sitz - dresden
>
___m i c h a e l s t a r k e____
geschäftsführer
HicknHack Software GmbH
www.hicknhack-software.com
___k o n t a k t____
+49 (170) 3686136
email@hidden
___H i c k n H a c k S o f t w a r e G m b H____
geschäftsführer - maik lathan | andreas reischuck | michael starke
bayreuther straße 32
01187 dresden
amtsgericht dresden HRB 30351
sitz - dresden
_______________________________________________
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