• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSButton in NSToolbarItem does not use "small size"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSButton in NSToolbarItem does not use "small size"


  • Subject: NSButton in NSToolbarItem does not use "small size"
  • From: Michael Starke <email@hidden>
  • Date: Sun, 24 Feb 2013 21:11:50 +0100

I'm trying to use a toolbar with NSButtons as the views for the toolbar items. I'm creating the views programmatically and ran into the following problem.

I add a NSSearchField a NSPopupButton and some NSButtons to the bar by creating a NSToolbarItem and using setView: on them with the appropriate controls (search field, popup and normal buttons)

If I add these and check "use small size" the NSButtons do not get scaled down. The search field and the popup button though both do scale up/down correctly. The funny thing is, if I add a NSButton with IB as a custom NSToolbarItem it get's scaled down.

I read that NSToolbarItem uses "setControlSize" to scale the view. So I tried to observe the cell for the keyPath "controlSize" and get notified just for the NSSearchField and the NSPopupButton but the NSButton seems to not get the call.

Do I have to take special care with the buttons? Or did something else break the scaling?

The initializations for the button item is as follows:

NSToolBarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 32, 32)];
[button setButtonType:NSMomentaryPushInButton];
[button setTitle:itemIdentifier];
[[button cell] setControlSize:NSSmallControlSize];
[[button cell] setBezelStyle:NSTexturedRoundedBezelStyle];
[button sizeToFit];
[item setView:button];
[button release];

___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


  • Follow-Ups:
    • Re: NSButton in NSToolbarItem does not use "small size"
      • From: Keary Suska <email@hidden>
  • Prev by Date: Dynamic library linking
  • Next by Date: Re: [OT] Sync vs ASync Server Comms
  • Previous by thread: Re: Dynamic library linking
  • Next by thread: Re: NSButton in NSToolbarItem does not use "small size"
  • Index(es):
    • Date
    • Thread