TextView font specification?
TextView font specification?
- Subject: TextView font specification?
- From: Jerry LeVan <email@hidden>
- Date: Sat, 7 Feb 2004 14:31:24 -0500
Hi,
I am still trying to get the "BigSQL" program from BigNerdRanch squared
away. I found a hang in this procedure,
it writes a colored string into outputTextView. The first time it is
called nothing has been written into the view.
**********
- (void)appendToLog:(NSString *)s color:(NSColor *)c
{
//return ; // jhl
NSFont *font = [outputTextView font];
NSLog(@"font: %@", font);
NSRange r;
NSTextStorage *ts = [outputTextView textStorage];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:c forKey:NSForegroundColorAttributeName];
[dict setObject:font forKey:NSFontAttributeName];
NSAttributedString *toAdd = [[NSAttributedString alloc]
initWithString:s attributes:dict];
[dict release];
[ts appendAttributedString:toAdd];
[toAdd release];
r.location = [ts length];
r.length = 0;
[outputTextView scrollRangeToVisible:r];
[outputTextView display];
}
*********
The first statement returns null for font and not the default Courier
12! This causes the statement
[dict setObject:font forKey:NSFontAttributeName] statement to fail. My
workaround was to set the font for
"outputTextView" explicitly in the AwakeFromNib routine.
Is there a way to set the font in the view from IB?
The supplied source code is pre Xcode and does compile and work. When
the supplied nib is updated to 10.2 the font problem rears its ugly
head...
Thanks,
--Jerry
_______________________________________________
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.