Re: Font Manager Problem
Re: Font Manager Problem
- Subject: Re: Font Manager Problem
- From: Henry McGilton <email@hidden>
- Date: Sun, 5 Oct 2003 15:01:29 -0700
On Sunday, October 5, 2003, at 02:27 PM, Andrew Thompson wrote:
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 . . .
Many Thanks Andrew,
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.
Whacka Whacka . . . I had read 'Methods Implemented by the Delegate'
in the
NSFontManager documentation and stopped reading there . . .
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.
Helped one heck of a lot . . .
I made CrafterController (which is File's Owner) the delegate of
the window in the NIB, and now it is working just fine.
Many Thanks Again,
Best Wishes,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.com
|
===============================+============================
_______________________________________________
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.