• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: settign font for data in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: renaming files
  • Next by Date: Newbie question regarding Learning Cocoa
  • Previous by thread: settign font for data in NSTableView
  • Next by thread: Not so basic after all (was: Very Basic)
  • Index(es):
    • Date
    • Thread