Skip navigation.
 
mlAdjusting NSTableView row height for custom fonts
FROM : Matt Judy
DATE : Thu Jan 10 18:57:00 2002

Hello,

I'm allowing the user to select the font for browsing a list in an
NSTableView.  I'm setting the font in the tableView's dataSource:

- (void)tableView:(NSTableView *)aTableView
      willDisplayCell:(id)aCell
      forTableColumn:(NSTableColumn *)aTableColumn
      row:(int)rowIndex
{
      if ([aCell respondsToSelector:@selector(setFont:)]) {
          NSFont *font = [preferences browseTableFont];
          [aCell setFont:font];
      }

      ...
}

When I do this, I have 2 problems.

1-) Even if I use the default font (Lucida Grande 13pt), it is drawn in
the cell below middle.  NSCell doesn't seem to have a method for setting
vertical alignment.

2-) The cell height is too small to display large fonts.  I can use
setRowHeight: to adjust the height of the cells, but the centering thing
is still a problem.

I'm assuming there's a nice implementation already in use out there...
How have you guys been doing this?

Thanks.
--Matt Judy



Related mailsAuthorDate
mlAdjusting NSTableView row height for custom fonts Matt Judy Jan 10, 18:57
mlRe: Adjusting NSTableView row height for custom fonts Ryan Stevens Jan 10, 19:05
mlRe: Adjusting NSTableView row height for custom fonts Bartsch, Alec Jan 10, 19:34
mlRe: Adjusting NSTableView row height for custom fonts Matt Judy Jan 10, 23:59
mlRe: Adjusting NSTableView row height for custom fonts Ryan Stevens Jan 11, 22:37