Re: settign font for data in NSTableView
Re: settign font for data in NSTableView
- Subject: Re: settign font for data in NSTableView
- From: Clyde McQueen <email@hidden>
- Date: Mon, 4 Jun 2001 06:14:41 -0700
Set a delegate for the view (e.g., the document, or the window
controller, if you have one), and implement the
tableView:willDisplayCell:forTableColumn:row: method.
From the docs:
tableView:willDisplayCell:forTableColumn:row: informs the delegate that
the NSTableView is about to draw a particular cell. The delegate can
modify the NSCell provided to alter the display attributes for that
cell; for example, making uneditable values display in italic or gray
text (as in the figure above)
Here's a snippet of code I'm using in NSOutlineView; it should be just
about the same:
- (void)outlineView:(NSOutlineView *)outlineView
willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn
item:(id)item
{
// Gray out stuff that can't be edited.
if ([[tableColumn identifier] isEqual:@"Name of a column that you
can't edit"]) {
[cell setTextColor:[NSColor grayColor]];
}
// Set the font size for all columns.
[cell setFont:[NSFont controlContentFontOfSize:11.0]];
}
/Clyde
On Sunday, June 3, 2001, at 07:56 PM, Max J Cantor wrote:
simple quesitons, how do you set the font for text in an NSTableView? I
checked the docs and foudn no simple answer.
-Max