Skip navigation.
 
mlRe: Adjusting NSTableView row height for custom fonts
FROM : Bartsch, Alec
DATE : Thu Jan 10 19:34:00 2002

Matt Judy wrote:
>
> 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:
>


Since you're using one font for the whole table, you could also set it
just once whenever the user changes for font, for example in the
changeFont: action method of your NSDocument.

Something like this (no guarantees, typing from memory):

-(void)changeFont:(id)sender
{
    NSFont* newFont = [sender convertFont: [sender selectedFont]];
    NSEnumerator* columns = [[myTableView tableColumns]
objectEnumerator];
    NSTableColumn* column;

    while (column = [columns nextObject])
        [[column dataCell] setFont: newFont];

    [myTableView setRowHeight: [newFont defaultLineHeightForFont] + 2];
}

Not sure about your vertical centering problem... I haven't seen that.

--------------------------------------------------------------------
Alec Bartsch / Walt Disney Feature Animation: The Secret Lab / x3227

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