Re: popup in table column
Re: popup in table column
- Subject: Re: popup in table column
- From: I.Savant <email@hidden>
- Date: Sun, 19 Jul 2009 19:54:53 -0400
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 (email@hidden)
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:
This email sent to email@hidden