[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can't use NSInvocation on NSFont
From: |
Yen-Ju Chen |
Subject: |
Can't use NSInvocation on NSFont |
Date: |
Fri, 11 Apr 2003 13:32:22 -0400 |
Hi,
I tried to use NSInvocation but failed.
Below is the testing code.
It always complains that
"NSInvalidArgumentException: NSFont(class) does not recognize fontInfo".
I surely put the instance as argument, not class.
Thanx a lot.
Yen-Ju
#include <AppKit/AppKit.h>
int main(int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSFont *font;
NSFontManager *manager;
NSInvocation *inv;
NSFontTraitMask valTraitM;
[NSApplication sharedApplication];
manager = [NSFontManager sharedFontManager];
font = [NSFont systemFontOfSize: [NSFont systemFontSize]];
NSLog(@"font %@", font);
valTraitM = NSBoldFontMask;
inv = [NSInvocation invocationWithMethodSignature: [manager
methodSignatureFor
Selector: @selector(convertFont:toHaveTrait:)]];
[inv setSelector: @selector(convertFont:toHaveTrait:)];
[inv setTarget: manager];
[inv setArgument: font atIndex: 2];
[inv setArgument: &valTraitM atIndex: 3];
[inv invoke];
[inv getReturnValue: &font];
NSLog(@"font %@", font);
RELEASE(pool);
return 0 ;
}
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
- Can't use NSInvocation on NSFont,
Yen-Ju Chen <=