Re: Changing the Text Color of an NSMenuItem in an NSPopUpButton?
Re: Changing the Text Color of an NSMenuItem in an NSPopUpButton?
- Subject: Re: Changing the Text Color of an NSMenuItem in an NSPopUpButton?
- From: email@hidden
- Date: Thu, 16 May 2002 14:37:00 -0700
Richard Kendall Wolf wrote:
|Take pity on a newbie! I promise I checked the archives first. Feel
|free to flame if I overlooked the answer in the archives.
Relax! Not everyone on this list is gunning down the newbies. And, if you keep score, you'll soon discover who does and who doesn't, and you can then ignore the ones who do.
|I think I have a legitimate reason to want to set the color of text in
|an NSMenuItem within an NSPopUpButton. Just so the user interface guys
|don't freak, I don't want to allow the user to be able to change the
|color ... and I want to restrict the text color to just two colors: red
|and black.
|
|All the methods that set/return text in a popup button do so with
|NSStrings. What I think I'm after is the NSText, for which I can set
|the color easily (just like I could, say, for an NSTextField).
I'm assuming you already know how to track down the appropriate NSMenuItem. This is pure guesswork, but what happens if you set the item title to an NSAttributedString? You can set the foreground and background colors of one, and that might give you what you need.
As a UI note: the colors you name suggest that you're intending to use the color as an indicator of some sort (an error indicator, I'd guess, that being what red is often used for). If so, keep in mind that not everyone can tell red from black (totally colorblind people will just see shades of grey, which are much less distinctive), so there should be something besides color that would also indicate whatever you'd be indicating. (Likely possibities: the menu item text itself, or the presence or absence of a mark on the menu item.) The rule from the old Apple UI guidelines (which may also be in the OS X version): your UI should work even if done in black and white; color should simply make it that much better.
Glen Fisher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.