Re: FW: Enhancing NSTableView
Re: FW: Enhancing NSTableView
- Subject: Re: FW: Enhancing NSTableView
- From: Tom Waters <email@hidden>
- Date: Sat, 26 May 2001 18:49:14 -0700
Set identifiers in your columns so you can find them after they've been
reordered.
cell = [[NSBrowserCell alloc] init];
[cell setLeaf: NO];
[[self tableColumnWithIdentifier: @"name"] setDataCell: cell];
then later in your delegate:
- (void)tableView:(NSTableView *)view
willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)col
row:(int)row
{
if ([[col identifier] isEqualTo: @"name"]) {
[cell setImage: [self getTheRightImageForThisRow: row]];
}
}
I'll leave the implementation of getTheRightImageForThisRow up to
you... :-)
You should be able to extrapolate from here how to support and change
the values of other cells for the rest of your columns.
On Saturday, May 26, 2001, at 05:27 PM, Mal Paine wrote:
I'm porting my already carbonized application over to cocoa (heck
yeah!) and
I need to enhance NSTableView. In one column, I need to display a small
document icon and a string, just like in the Finder. In the next, I
need to
have a popup menu. The third and final column is the most complex, as I
need
it to show a progress bar (but only sometimes), a string, and a
checkbox.
Obviously I'm not asking you to code this for me, but I'm wondering if
anyone can point me in the right direction for example source code that
shows how to place a control into a cell of a table. Any ideas or tips?
I'm
sure I could figure out the rest of it if I saw a simple one-column
example
that uses a control....
Thanks so much!
Mal
P.S. Before WWDC, I had ignored cocoa, and I thought my application was
going to live healthily as a carbon citizen. Then I saw the light. Cocoa
rocks, and that's coming from a previous cocoa-hater.