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
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 mails | Author | Date |
|---|---|---|
| Matt Judy | Jan 10, 18:57 | |
| Ryan Stevens | Jan 10, 19:05 | |
| Bartsch, Alec | Jan 10, 19:34 | |
| Matt Judy | Jan 10, 23:59 | |
| Ryan Stevens | Jan 11, 22:37 |






Cocoa mail archive

