Re: Attributed menu titles
Re: Attributed menu titles
- Subject: Re: Attributed menu titles
- From: Peter Ammon <email@hidden>
- Date: Wed, 9 Jul 2008 17:57:14 -0700
On Jul 9, 2008, at 4:42 PM, Kiel Gillard wrote:
Hi all,
I have a menu of items whose titles are attributed strings. I have
specified
custom colours for parts of those strings. The documentation reads:
If you do not set a text color for the attributed string, it is
black when
not selected, white when selected, and gray when disabled. Colored
text
remains unchanged when selected.
Is there some way to provide a colour for the NSMenuItem's
attributedTitle
when the item is selected or disabled? For example, is there some
key I can
set in an attributes dictionary that allows me to specify a colour
to use
when either of these cases occurs? Have I overlooked or missed
something in
the documentation?
There's no built in way to do this. One way would be to use the
delegate method menu:willHighlightItem: to change the attributed title
when the item is highlighted or unhighlighted.
However, there's no guarantee that the menu item highlight color will
be stable across OS releases. What looks good today may not look good
on a future OS version. For that reason, most developers let the
frameworks take responsibility for inverting menu item titles, and
just live with the fact that colored portions do not invert.
-Peter
_______________________________________________
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