Re: NSFontManager changeFont not called
Re: NSFontManager changeFont not called
- Subject: Re: NSFontManager changeFont not called
- From: Alexander Veenendaal <email@hidden>
- Date: Tue, 25 Jun 2002 20:52:27 +0100
On Monday, June 24, 2002, at 12:26 PM, Scott Anguish wrote:
On Monday, June 24, 2002, at 06:30 AM, Alexander Veenendaal wrote:
I am having issues trying to get the font panel to send a changeFont:
message to my NSView subclass. A similar problem has been asked a few
times before:
look at this instead...
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/
FontHandling/Tasks/RespondingToFontChanges.html
Didn't really help that much.
or, if you don't mind muddling through code that hasn't been moved
to Cocoa yet, but is applicable (it's for setting a font as a default
in a panel)
http://www.stepwise.com/Articles/Technical/HTMLEditor/HTMLEditor-5.html
Following this guide, on the other hand, finally provided me with
results.
What I did was:
- move the changeFont method to another class which I made a subclass of
NSWindowController.
- In Interface Builder, I connected the NSWindowController subclasses
window outlet to my applications window.
- I added this code to my NSWindowController subclass and connected it
to a button in my applications window:
[[myView window] makeFirstResponder:[selectFontButton window]];
[[NSFontManager sharedFontManager] orderFrontFontPanel:self];
[[NSFontManager sharedFontManager] setSelectedFont:[myView font]
isMultiple:NO];
et voila, changeFont gets called in the NSWindowController subclass when
I make a selection in the FontManager.
However, I'm still not completely clear as to why the NSWindowController
subclass worked and not the NSView subclass.
The Apple docs could be a little clearer on this matter.
thanks for the advice.
_______________________________________________
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.