I'm creating an NSFontPanel
but selecting a font doesn't call the changeFont:
method.
I have these methods defined in an NSWindowController
subclass:
- (IBAction)showFontPanel:(id)sender {
[[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSFont *theFont = [NSFont fontWithName:[prefs stringForKey:iepFontName] size:[prefs floatForKey:iepFontSize]];
[[NSFontPanel sharedFontPanel] setPanelFont:theFont isMultiple:NO];
[[NSFontManager sharedFontManager] setDelegate:self];
}
- (void)changeFont:(id)sender {
NSLog(@"changeFont");
}
- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel {
return NSFontPanelFaceModeMask | NSFontPanelSizeModeMask | NSFontPanelCollectionModeMask;
}
The font panel appears with the correct font and size selected and only the modes enabled in validModesForFontPanel:
, but when I select a different font, the changeFont:
method doesn't get called. My understanding is that the changeFont:
action message gets sent up the responder chain. As a test, I put an identical changeFont:
method in my application delegate (which is supposed to be in the responder chain) but it isn't getting called either. Am I missing a step somewhere?