Re: NSTableView
Re: NSTableView
- Subject: Re: NSTableView
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 27 May 2002 06:31:16 -0400
on 02-05-27 12:36 AM, Matthew Johnson at email@hidden wrote:
>
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?
Use the NSTableView method tableView:willDisplayCell:forTableColumn:row:. It
will be called automatically whenever Cocoa needs to display your table's
cells.
Here's how I make the word "New" bold in every cell in a particular column
of the table. You can adapt this to your case.
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(int)row { // r11
// Delegate method per NSTableView to alter cell's appearance before it
is displayed in table.
if (tableView == [self antiquesTable]) {
[cell setFont:([[cell stringValue]
isEqualToString:NSLocalizedString(@"New", @"Kind of new antique record")] ?
[NSFont boldSystemFontOfSize:[NSFont systemFontSize]] : [NSFont
controlContentFontOfSize:[NSFont systemFontSize]])];
}
}
I believe you will find documentation about this in the NSTableView class
reference document.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
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>) |