Error when switching to new nib format
Error when switching to new nib format
- Subject: Error when switching to new nib format
- From: Andrew Merenbach <email@hidden>
- Date: Sun, 13 Oct 2002 14:49:37 -0700
I have a custom button cell class in one of my programs, and recently
switched over to the new nib format. Now, whenever I run my program, I
receive the following error:
>
2002-10-13 14:44:10.554 ChemBuddy[1457] *** -[CBFeatureButtonCell
>
_isDefaultFace]: selector not recognized
>
2002-10-13 14:44:10.591 ChemBuddy[1457] An uncaught exception was
>
raised
>
2002-10-13 14:44:10.618 ChemBuddy[1457] *** -[CBFeatureButtonCell
>
_isDefaultFace]: selector not recognized
>
2002-10-13 14:44:10.647 ChemBuddy[1457] *** Uncaught exception:
>
<NSInvalidArgumentException> *** -[CBFeatureButtonCell
>
_isDefaultFace]: selector not recognized
>
>
ChemBuddy has exited due to signal 5 (SIGTRAP).
When I switch back to the old nib file format, the problem goes away
completely and my program runs as before.
The code in my button cell class is as follows:
@implementation CBFeatureButtonCell
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView
{
[self drawFeatureSymbol: cellFrame];
[self drawFeatureName: cellFrame];
}
- (void) drawFeatureSymbol: (NSRect) r
{
NSPoint stringOrigin;
NSSize stringSize;
NSMutableDictionary *attributes;
NSString *mainTitle = [self alternateTitle];
attributes = [[NSMutableDictionary alloc] init];
[attributes setObject: [NSFont systemFontOfSize:56] forKey:
NSFontAttributeName];
[attributes setObject: [NSColor blackColor] forKey:
NSForegroundColorAttributeName];
//_realTitle = [self title];
stringSize = [mainTitle sizeWithAttributes: attributes];
stringOrigin.x = r.origin.x + (r.size.width - stringSize.width)/2;
stringOrigin.y = r.origin.y + (stringSize.height)/8; //-
stringSize.height/2;
stringOrigin.y -= 0;
[mainTitle drawAtPoint: stringOrigin withAttributes: attributes];
[attributes release];
}
- (void) drawFeatureName: (NSRect) r
{
NSPoint stringOrigin;
NSSize stringSize;
NSMutableDictionary *attributes;
NSString *numberTitle = [self title];
attributes = [[NSMutableDictionary alloc] init];
[attributes setObject: [NSFont systemFontOfSize:10] forKey:
NSFontAttributeName];
[attributes setObject: [NSColor blackColor] forKey:
NSForegroundColorAttributeName];
stringSize = [numberTitle sizeWithAttributes: attributes];
stringOrigin.x = r.origin.x + (r.size.width - stringSize.width)/2;
stringOrigin.y = r.origin.y + r.size.height - (stringSize.height)*2;
stringOrigin.y -= 0;
[numberTitle drawAtPoint: stringOrigin withAttributes: attributes];
[attributes release];
}
The program is for chemical analysis, and I display the main features
as buttons, in the style of the periodic table, and thus I draw both
the main and alternate titles of each button cell at the same time,
which provides a neat look for the interface.
Does anyone have any pointers regarding the new nib file format? Can I
not use custom button cell subclasses with it?
Take care,
Andrew Merenbach
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.