Re: Using NSCell to bold cells in a tableview
Re: Using NSCell to bold cells in a tableview
- Subject: Re: Using NSCell to bold cells in a tableview
- From: matt neuburg <email@hidden>
- Date: Sun, 29 Dec 2002 09:52:26 -0800
On Sat, 28 Dec 2002 11:10:46 -0800, Mike Ferris <email@hidden> said:
>
- You could subclass NSTableColumn and return different cells for
>
-dataCellForRow:
>
- You could implement
>
-tableView:willDisplayCell:forTableColumn:row: in your table view
>
delegate and set the one data cell's font appropriately each time it is
>
used.
>
- You could return attributed strings from your dataSource's
>
-tableView:objectValueForTableColumn:row: instead of a simple string
>
and have the attributed strings be bold or not (or whatever)
>
>
Which one is right for you depends. Since the cells are always textual
>
in your case and it is just the font changing, I would steer clear of
>
the first possibility. -dataCellForRow: is most useful for cases like
>
PropertyListEditor where different classes of cell
That's a good point. I originally developed my way of handling dataCellForRow: in a situation where some cells were buttons and some were text, so naturally whenever the matter comes up now I simply reduce it to the previously solved problem... :)
Incidentally, the way I do this is to have a subclass of NSTableColumn whose dataCellForRow: turns to the datasource for the actual cell. This way, my NSTableColumn subclass is universally useful, since it doesn't contain any actual functionality (that is, it knows nothing about how to generate the cells or even whether there is a need to do so); if the datasource implements the corresponding method (which I call dataCellForRow:sender:), it is called, otherwise the default behaviour is used. Thus, in my project, *every* table column is a MyTableColumn. In my view this is how dataCellForRow: should have been implemented in the first place, thus making subclassing unnecessary. m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.