NSTextView text color alpha value?
NSTextView text color alpha value?
- Subject: NSTextView text color alpha value?
- From: Doug Brown <email@hidden>
- Date: Mon, 11 Feb 2002 18:34:45 -0800
Is it possible to have transparent text in a text view? Here's a code
snippet that doesn't seem to change the alpha value (it works great with
different colors though):
(sAppend is the NSString to be appended)
NSMutableAttributedString *attStr;
NSAttributedString *temp;
if (!sAppend)
return;
attStr = [[NSMutableAttributedString alloc]
initWithRTF:[chatTextView RTFFromRange:NSMakeRange(0, [[chatTextView
string] length])] documentAttributes:nil];
temp = [[NSAttributedString alloc] initWithString:sAppend
attributes:[NSDictionary dictionaryWithObjectsAndKeys:[[NSColor
redColor] colorWithAlphaComponent:0.5], NSForegroundColorAttributeName,
[NSFont userFixedPitchFontOfSize:0.0], NSFontAttributeName, nil]];
[attStr appendAttributedString:temp];
[chatTextView replaceCharactersInRange:NSMakeRange(0, [[chatTextView
string] length]) withRTF:[attStr RTFFromRange:NSMakeRange(0, [attStr
length]) documentAttributes:nil]];
[temp release];
[attStr release];
This code is kind of dirty right now but it does the job except for the
alpha value. Any suggestions? Thanks.
Doug
_______________________________________________
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.