On Jul 19, 2009, at 7:38 PM, Daniel Child wrote:

I am confused by what seem to be two possible approaches to placing popup button cells into a table.

If I understand the documentation, one can:

a) set the popup button cell as the data cell of the (subclassed) column

OR

b) return the popup button cell in the table datasource method:

- (id)  tableView: (NSTableView *) tableView
objectValueForTableColumn: (NSTableColumn *) tableColumn
row: (int) row

Which is considered the correct approach?

A isn't quite right. Not exactly. It depends on what you're trying to accomplish. Columns tend to show one kind of data, so you set the data cell of a table column (you don't need to subclass NSTableColumn) in code or in Interface Builder.

B is absolutely wrong. The -tableView:objectValueForTableColumn:row: datasource method is a way for you to return the **objectValue** as the name suggests (and the document clearly states), not the cell to use to display this data.

You might be confusing this (B) with the NSTableView delegate method -tableView:willDisplayCell:forTableColumn:row: where you can substitute cells at will. This probably less efficient, especially if your entire column will always use one kind of cell (ie, the "Employee Department" column is always a popup, populated with all the departments).

All that to say this: You need to re-read the documentation because you've misunderstood some important concepts.


Is there a basic tutorial on this?

 Dozens. Use Google.

--
I.S.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to