attributedTitle method of NSMenuItem returns no attributes
attributedTitle method of NSMenuItem returns no attributes
- Subject: attributedTitle method of NSMenuItem returns no attributes
- From: Gezim Hoxha <email@hidden>
- Date: Mon, 13 Aug 2007 14:14:49 -0700 (PDT)
Hi all.
I'm trying to get the attributed title of an
NSMenuItem like this:
// button is an NSPopUpButton created in IB
NSMenuItem *firstItem = [[button menu] itemAtIndex:
0];
NSAttributedString *firstsAttributes = [firstItem
attributedTitle];
NSDictionary *firstsDictionary = [firstsAttributes
attributesAtIndex: 0 effectiveRange: NULL];
NSSize firstsSize = [firstsAttributes size];
NSLog (@"firstsDictionary is %d big.",
[firstsDictionary count]);
// this prints "firstsDictionary is 0 big."
NSLog (@"firsts W: %f H: %f", firstsSize.width,
firstsSize.height);
// this prints "firsts W: 0.000000 H: 0.000000"
NSLog (@"firsts attributedstring title: '%@'",
[firstsAttributes string]);
// this prints "firsts attributedstring title:
'(null)'"
NSLog (@"firsts title: '%@'", [firstItem title]);
// this prints "firsts title: 'Item0'"
Why does the NSAttributedString have no attributes?
How can I get the size of an NSMenuItem? (This is the
ultimate goal for now.)
Any help would be greatly appreciated.
_______________________________________________
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