Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 18, 2009, 03:08 PM   #1
tmeehan
macrumors newbie
 
Join Date: Feb 2009
How do I set the text color for a NSPopUpButtonCell

I've got a NSPopUpButtonCell in my NSTableView. I've tried everything I can think of but I can't get the text color to change. I've read numerous posts (on other formums) about how this is done. The most recent was setting the individual menuitem titles with -setAttributedTitle. I've put in debug code to verify that title being used is my attributed string - which was created using the following attributes:

attrs = [NSMutableDictionary dictionaryWithCapacity:3];
[attrs setValue:[NSColor redColor] forKey:@"NSForegroundColorAttributeName"];
[attrs setValue:[NSColor redColor] forKey:@"NSStrokeColorAttributeName"];
[attrs setValue:[NSNumber numberWithFloat:8.0] forKey:@"NSStrokeWidthAttributeName"];

I've also checked the attributes of the string each place where it should be used to verify that the color is the color it is supposed to be.

the only clue is that I can tell that it is using the string because the appearance changes in the popup menu. The line spacing is tighter together than if I just use the normal title with an NSString. It's as if it can't understand the attributes because as you can see I put in an 8 for the strokewidth ( a huge number) just to see if anything changed - nothing changed.

Does anyone have a solution. I can't imagine that this is one of those things that can't be done. I'm sure I am missing something somewhere.

Any help would be greatly appreciated. Thanks.
tmeehan is offline   0 Reply With Quote
Old Mar 18, 2009, 04:41 PM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
The color of each menu title, or the color of the popup button's title, or both?
kainjow is offline   0 Reply With Quote
Old Mar 19, 2009, 08:26 AM   #3
tmeehan
Thread Starter
macrumors newbie
 
Join Date: Feb 2009
Colorizing NSPopUpButtonCell

Both actually. I would like to be able to colorize any and all text that is displayed by the popup menu.

The sad thing is that earlier in my attempts to get the big picture working I was struggling to get the text in the normal text cells to colorize. At one point the popupmenu text was being colorized but the text cells were not. At the time it was a frustration because I was trying to get the text cells to colorize. Little did I know that once I got that problem solved, I would not be able to get the popupmenucells to colorize to save my life.
tmeehan is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How do people change the battery color on the status bar RonHC Jailbreaks and iOS Hacks 0 Aug 10, 2010 04:07 PM
How do you override the default color print setting? bluestripes Mac Basics and Help 0 May 10, 2010 08:06 PM
How do I change the pop-up color of the Dock? satointl OS X 7 Dec 21, 2009 04:28 PM
How do i replace the text in the top left corner... GRAYgoose12 iPod touch Hacks 5 Jan 3, 2009 02:56 PM
How do I set a background image for the home page? cavaliers60 iPod touch Hacks 0 Feb 27, 2008 01:29 PM


All times are GMT -5. The time now is 08:37 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC