In article <110120042244007765%nospam.net>,
Steve Ketcham <nospam.net> wrote:
You seem to have some misconceptions about how NSTableView works, so I'm
snipping most of your post. The dataCell connection is supposed to
connect to a cell, not a view. An NSPopUpButton is an NSView. You should
instead use NSPopUpButtonCell.
If you're using Interface Builder with Xcode, then it's fairly easy to
do. In the palette where the table view is, there's a popup button thing
you can drag into your table's data column header. If you're using an
older version of IB, you have to create it in code. You can use NSCell's
setControlSize: method to control the size.
An NSTableView reuses the cell when it draws. It doesn't keep one copy
of the cell around for each row, it only has one cell for the entire
column. That means that when you change the cell around, you have to
keep this in mind, it will be a global change. If you need to make
per-row changes to the cell, there is an NSTableView delegate method you
can implement that lets you change the cell right before it's drawn.
Likewise, NSTableView works differently for cell values. You don't set
the cell value directly. Rather, NSTableView sets the cell value right
before it draws the cell, using the object value that it gets from your
data source. In the case of a popup menu, your data source should return
an NSNumber that corresponds to the index of the selected item. Your
data source's set value method will be called with the same kind of
thing when the user makes a selection.
You seem to be trying to do things outside of the whole delegate/data
source idea, which basically won't work. Everything has to go through
the data source when you're setting values.