• 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: Using NSCell to bold cells in a tableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSCell to bold cells in a tableview


  • Subject: Re: Using NSCell to bold cells in a tableview
  • From: James DiPalma <email@hidden>
  • Date: Sat, 18 Jan 2003 23:54:11 -0800

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.

A few points:

- Datasource api usually doesn't deal with cells and you'll notice that all willDisplayCell: type calls are to delegates and not to data sources. It is not unusual for a data source and a delegate to be a single object, but I would avoid adding cell responsibilities to a data source protocol.

- Using sender:. "sender" arguments are common in Cocoa, but NSTableDataSource and NSTableView-delegate messages all use tableView and tableColumn in their informal-protocol methods. Also, a casual look through all Cocoa methods that use sender shows only a single method that uses "sender" as part of its selector name: -takeSelectedTabViewItemFromSender: (which avoids looking like takeNnnnValueFrom: methods, so I'm not sure this counts as an example or a bug).

I would consider defining a delegate method as part of NSTableView (and yes, call it from an NSTableColumn subclass -- feels a little wierd though, so I could go either way) since NSTableView's have a delegate and NSTableColumns don't. And, consider a method like: -tableView:dataCellForTableColumn:row: (which is similar to tableView:willDisplayCell:forTableColumn:row:.


-jim
_______________________________________________
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.

  • Prev by Date: Re: Question about keyboard shortcuts
  • Next by Date: How can I release an NSString?
  • Previous by thread: Re: UUID Generation in Cocoa
  • Next by thread: How can I release an NSString?
  • Index(es):
    • Date
    • Thread