Programmatically creating a small check box
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