Re: Font Manager Problem
Re: Font Manager Problem
- Subject: Re: Font Manager Problem
- From: Andrew Thompson <email@hidden>
- Date: Sun, 5 Oct 2003 17:27:53 -0400
On Sunday, Oct 5, 2003, at 16:09 America/New_York, Henry McGilton wrote:
In CrafterController I verify that the Font Manager's delegate is
the same object that was set in Controller, above. Problem is,
Controller in the main NIB never sees changeFont messages that 'should'
be coming from the Font Manager. I have been staring at this for
several days now and do not see the obvious blunder, or, more likely,
I am missing something fundamental . . .
Chances are you've hit a common problem in this area.
Despite some versions of the Cocoa documentation having screwed up
formatting that made it look like changeFont: is a delegate method, in
fact, it is not.
Look again closely at the documentation: its a method that's sent up
the current responder chain.
You probably need to read about the responder chain and figure out how
to insert yourself into it such that you get the notification you need.
Beware though: many standard controls (eg, NSTextView) will eat
changeFont: messages if they see them before your code does.
The symptoms for that are generally that sometimes your code is called
and sometimes it is not... it will depend on where the input focus is
in your application.
What tends to happen is something in the responder chain is eating the
changeFont: message before it gets to your code (assuming your
controller in in the responder chain at all, which it would be if its
also the Application delegate, for example).
A way around that, if you hit it, is to call NSFontManager setAction:
and substitute your own action (eg, myChangeFont:) for the standard one.
Then you can put yourself in the responder chain and listen for that
custom action. Once you've done your thing, you can then send the
regular changeFont: action up the responder chain to make sure all of
the built in Cocoa controls get their chance to do whatever they would
normally do (if you need this).
Hope that helps.
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy ...)
_______________________________________________
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.