Re: NSTableView
Re: NSTableView
- Subject: Re: NSTableView
- From: Joe Morris <email@hidden>
- Date: Thu, 30 May 2002 06:28:20 -0400
Finally sitting at my home computer, this is the code I used (feel free
to copy :-)). Right now I've commented out the bolded font, but you can
see easily how to make that switch.
//used to display groups in bold
- (void)tableView:(NSTableView*)sender willDisplayCell:(NSCell*)cell
forTableColumn:(NSTableColumn*)column row:(int)row {
//if a group, display in bold blue :-)
if ([ [ [displayedCreatures objectAtIndex:row] objectForKey:TYPE]
isEqualToString:GROUP]) {
NSColor *txtColor = [NSColor blueColor];
NSFont *txtFont = [NSFont /*boldS*/systemFontOfSize:13];
NSDictionary *txtDict = [NSDictionary
dictionaryWithObjectsAndKeys:txtFont,
NSFontAttributeName, txtColor, NSForegroundColorAttributeName,
nil];
NSString *string = [self tableView:sender
objectValueForTableColumn:column row:row];
NSAttributedString *attrStr = [ [ [NSAttributedString alloc]
initWithString:string attributes:txtDict] autorelease];
[cell setAttributedStringValue:attrStr];
}
}
-Joe
On Monday, May 27, 2002, at 12:30 AM, Matthew Johnson wrote:
Hi,
If I had a table that had a list of names in it and I wanted all the
names that contained a 'd' to appear red instead of
black like the rest of the names.
How would I do that?
Matt
_______________________________________________
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.
"God made me an atheist. Who are you to question his wisdom?"
_______________________________________________
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.
References: | |
| >NSTableView (From: Matthew Johnson <email@hidden>) |