• 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
Programmatically creating a small check box
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Programmatically creating a small check box


  • Subject: Programmatically creating a small check box
  • From: Frederik Slijkerman <email@hidden>
  • Date: Sun, 27 Dec 2009 14:45:09 -0300

Hi,

I am creating a check box programmatically and need to set its control size to small. My code is something like:

NSButton *check = [NSButton initWithFrame: ...];
...
[[check cell] setControlSize:NSSmallControlSize];
[check setFont:[NSFont systemFontOfSize:
  [NSFont systemFontSizeForControlSize:NSSmallControlSize]]];

However, the text of the checkbox now ends up at the bottom of the control, instead of being vertically aligned. Screen shot:
http://www.ezlect.com/temp/checkbox.jpg


Of course, when changing the control size to small in Interface Builder, everything is aligned correctly. It looks like the check box somehow caches its text height and doesn't update that value when setFont is called.

What am I missing?

Thanks!
Frederik
_______________________________________________

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: Programmatically creating a small check box
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Having problems understanding NSPredicateEditor
  • Next by Date: Re: Programmatically creating a small check box
  • Previous by thread: Re: Removing the dragging image
  • Next by thread: Re: Programmatically creating a small check box
  • Index(es):
    • Date
    • Thread