Skip navigation.
 
mlNSTable Column Issues
FROM : Roberto Arias
DATE : Tue Apr 05 19:31:08 2005

Hi,

Is it possible to use a tableColumn with a NSPopUpButtonCell and set
different data sources for every popup in the column?

I've tried using the delegate method
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
  forTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
    SString * identifier = [tableColumn identifier];
    if ([identifier isEqualToString:@"subgenre"]) {
        if (row == 2) { 
            [cell addItemWithTitle:@"sabor"];
   }
    }
}// its a dummy example, just to try the delegate behavior.

And it changes all rows from row #2, instead of changing just row #2...

May be subclassing NSTableColumn is the way to go? If so, does anybody
has an example, or something? I think I would need to override
dataCellByRow, but I'm not sure how to do it.

By the way, what Im trying to do is to change the contents of the
popup in the column #3, based on the selection of the column #2 (which
is also a popup). Something like:

Title  |    Category 1    | Category 2 | ...
title    |      movie            |    terror      | ...
title 2 |      song              |    disco      | ...

So, when 'movie' is selected, the popup Category 2 shows 'terror',
'drama', 'comedy', etc.

May be my approach is completly wrong?

Related mailsAuthorDate
No related mails found.