This is EnhancedMatrix.m in view mode; [Download] [Up]
#import "EnhancedMatrix.h" #import "TokenString.h" @implementation Matrix (EnhancedMatrix) - (void)loadFromString: (const char *) str { id items = [[[TokenString alloc] init: str] autorelease]; const char *label; int x; [items setSeparator: ';']; [self renewRows: 0 cols: 1]; x = 0; while((label = [items popStringValue])) { [self addRow]; [[self cellAt: x : 0] setTitle: label]; x++; } [self sizeToCells]; [self display]; } - cellAt: (int) row { return [self cellAt: row : 0]; } - (const char *) selectedStringValue { id aCell = [self selectedCell]; if(!(aCell && [aCell title])) return ""; return [aCell title]; } - (void) selectCellWithTitle: (const char *)str { int rows, cols, x; [self clearSelectedCell]; if(!(str && *str)) return; [self getNumRows: &rows numCols: &cols]; for ( x = 0 ; x < rows ; x++) if(!strcmp([[self cellAt: x : 0] title], str)) { [self selectCellAt: x : 0]; break; } } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.