Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

medasmx

macrumors member
Original poster
Nov 9, 2008
89
0
I am trying to make a simple custom cell program. The code below has a matrix of four square buttons. There is a popupbutton associated with it that is supposed to plug the custom cell into the square button of a matrix. The custom cell I made is just a blue box (simple, to start out with). The program compiles but then says "An uncaught exception was raised
-[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class"

Below is the code. Thanks for any help or suggestions.

Code:
//  myCell.h
//  asmmatrix5


#import <Cocoa/Cocoa.h>


@interface myCell : NSView {
NSBezierPath*myPath;
}

@end
//  myCell.m
//  asmmatrix5
//

#import "myCell.h"


@implementation myCell

-(void)drawInteriorWithFrame:(NSRect)rect inView:(NSView*)theControlView
{
myPath=[NSBezierPath bezierPathWithRect:rect];
NSColor*myColor=[NSColor blueColor];
[myColor set];
[myPath fill];
}

@end
//  AppController.h
//  asmmatrix5
//

#import <Cocoa/Cocoa.h>
@class myCell;

@interface AppController : NSObject {
IBOutlet myCell*CVOutlet;
IBOutlet NSMatrix*myMatrix;
NSString*adamString;
}
-(IBAction)myPopUp:(id)sender;
@end
//  AppController.m
//  asmmatrix5

#import "AppController.h"
#import "myCell.h"

@implementation AppController

-(IBAction)myPopUp:(id)sender
{
adamString=[(NSPopUpButton*)sender titleOfSelectedItem];
if([adamString isEqualToString:@"one"])
	[myMatrix putCell:CVOutlet atRow:0 column:0];
if([adamString isEqualToString:@"two"])
	[myMatrix putCell:CVOutlet atRow:0 column:1];
if([adamString isEqualToString:@"three"])
	[myMatrix putCell:CVOutlet atRow:1 column:0];
if([adamString isEqualToString:@"four"])
	[myMatrix putCell:CVOutlet atRow:1 column:1];
}

@end
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.