Re: Text Color in NSButton?
Re: Text Color in NSButton?
- Subject: Re: Text Color in NSButton?
- From: Steve <email@hidden>
- Date: Fri, 29 Nov 2002 09:38:46 +0000
Thanks:
NSMutableDictionary *attrs = [[NSMutableDictionary alloc]init];
NSFont *font = [NSFont fontWithName:@"Lucida Grande" size:10.0];
[attrs setObject:font forKey:NSFontAttributeName];
[attrs setObject:[NSColor
redColor]forKey:NSForegroundColorAttributeName];
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]
initWithString:originalString attributes:attrs];
[myButton setAttributedTitle:attrStr];
This works, but I couldn't find how to centralize the drawing position
within the buttton.
Also, none of the attribute types listed in the documentation apply to
bold/italic styles, and yet there is an NSUnderlineStyleAttributeName.
Steve
On Thursday, November 28, 2002, at 12:28 PM, Sherm Pendley wrote:
On Thursday, November 28, 2002, at 06:45 AM, Steve wrote:
How do I programmatically change the text color of the title of an
NSButton?
Create an NSAttributedString with the properties you want (color,
font, etc.), and assign it to the button with setAttributedTitle:.
sherm--
If you listen to a UNIX shell, can you hear the C?
_______________________________________________
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.
_______________________________________________
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.