This is SimpleController.m in view mode; [Download] [Up]
/* * You may freely copy, distribute, and reuse the code in this example. * NeXT disclaims any warranty of any kind, expressed or implied, as to its * fitness for any particular use. * David A. Cheslow disclaims any warranty of any kind, expressed or implied, as to its * fitness for any particular use. */ #import <appkit/Panel.h> #import <appkit/FormCell.h> #import <appkit/Button.h> #import "CWAVScrollView.h" #import "SimpleController.h" #import "SimpleObject.h" @implementation SimpleController - matrixAction:sender { NXRunAlertPanel("Click!","you clicked in the cell for Simple Object # %d", NULL,NULL,NULL,[sender selectedRow]); return self; } - addName:sender { id newNameObject = [[SimpleObject alloc] init]; [newNameObject setLastName:(char *)[lastNameField stringValue]]; [newNameObject setFirstName:(char *)[firstNameField stringValue]]; [newNameObject setMiddleInit:(char *)[middleInitField stringValue]]; [simpleList addObject:newNameObject]; [scrollingList loadCWAVMatrix]; [[scrollingList cwavMatrix] scrollCellToVisible:[simpleList count]-1 :0]; [[scrollingList cwavMatrix] selectCellAt:[simpleList count]-1:0]; return self; } #define LASTNAMETAG 1 #define FIRSTNAMETAG 2 #define MIDDLEINITTAG 3 - loadCWAV:cell from:(unsigned)index { id currentNameObject = [simpleList objectAt:index]; [[cell findControlWithTag:LASTNAMETAG] setStringValue:(const char *)[currentNameObject lastName]]; [[cell findControlWithTag:FIRSTNAMETAG] setStringValue:(const char *)[currentNameObject firstName]]; [[cell findControlWithTag:MIDDLEINITTAG] setStringValue:(const char *)[currentNameObject middleInit]]; return self; } - (unsigned)count { return [simpleList count]; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.