resizing NSSegmentedControl automatically
resizing NSSegmentedControl automatically
- Subject: resizing NSSegmentedControl automatically
- From: Gezim Hoxha <email@hidden>
- Date: Wed, 8 Aug 2007 15:27:47 -0200
- Importance: Normal
Hi all,First, I'm new to the list and to Mac development in general.I want to have NSSegmentedControl segments autoresize so the content (be it images, or text) is not truncated horizontally. (Right now the problem is with text, since it can have different attributes.)In order to accomplish this, I though I would just measure the width of the label (text content) of a segment and then add some padding to that and set the width of the segment to that number. I was thinking of getting the size (width) of the label using the sizeWithAttributes: method of NSString. This method takes an NSDictionary containing the attributes of the label. However, I don't know how to get the attributes of a segment (or the whole NSSegmentedControl for that matter). There does not seem to be an attributedLabelForSegment: method for the NSSegmentedControl. Since, NSSegmentedControl inherits from NSControl, I tried using the attributedStringValue: method of NSControl, however this seems to set the dictionary to an empty dictionary (count method returns 0) no matter the font type or size of the NSSegmentedControl.Any help with this would be greatly appreciated.Thanks,-Gezim
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx_______________________________________________
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