I have been messing around with custom nscells, to put them in a matrix. That was my last post. However, I don't think I have a great grasp on nsmatrix first. So I tried to write a program that takes a nspopupbutton, and puts a string "jimmy" into one of four boxes in a nsmatrix. When I compile it it runs but nothing happens. Selecting different indices on the popupbutton doesn't do anything. When you terminate the compiler, you get the following message: "[NSTextField setControlView:]: unrecognized selector sent". Any help would be appreciated. Below is the code. Thanks. Adam
Code:
#import <Cocoa/Cocoa.h>
@interface AppController : NSObject {
IBOutlet NSMatrix*myMatrix;
NSString*myString;
NSTextField*myTextField;
}
-(IBAction)myButton:(id)sender;
@end
#import "AppController.h"
@implementation AppController
-(IBAction)myButton:(id)sender
{
[myMatrix setCellClass:[NSTextField class]];
myTextField=[[NSTextField alloc]init];
[myTextField setStringValue:@"jimmy"];
myString=[(NSPopUpButton*)sender titleOfSelectedItem];
if([myString isEqualToString:@"one"])
[myMatrix putCell:myTextField atRow:0 column:0];
if([myString isEqualToString:@"two"])
[myMatrix putCell:myTextField atRow:0 column:1];
if([myString isEqualToString:@"three"])
[myMatrix putCell:myTextField atRow:1 column:0];
if([myString isEqualToString:@"one"])
[myMatrix putCell:myTextField atRow:1 column:1];
}
@end