Re: NSFontPanel again
Re: NSFontPanel again
- Subject: Re: NSFontPanel again
- From: Andy <email@hidden>
- Date: Tue, 26 Nov 2002 22:20:48 -0500
Yann Bizeul wrote:
>
>
Hi,
>
>
I took a deep look to the list but did not find definitive answer to my
>
problem, that is quite simple :
>
I'm writing a PreferencePane that needs to take font settings into
>
considerations, so I made a button that opens the shared NSFontPanel
>
via NSFontManager. Good...
>
But now I'm unable to get font changes back, I set the delegate of
>
NSFontManager to myself without results, the changeFont method is never
>
called.
>
I saw that someone finaly made it work by instanciating a
>
NSWindowController for his window and catching changeFont inside, but
>
no results for me.
>
My main class is a NSPreferencePane subclass
>
>
So here is my question :
>
In the case of a preferencePane, who is lucky enough to get the
>
changeFont: method ?
>
And How can I handle it ?
>
If you look really closely at the documentation, or better yet
NSFontPanel.h, you'll see that changeFont: is not a delegate method.
Some versions of the documentation are corrupted (I don't know if its
fixed yet) so it looks like changeFont: is in the delegate methods
section, but it really isn't, as the .h file will confirm.
Its actually a method that is sent to the First Responder, and goes up
the Responder chain. Catching it in the window controller might work,
but you could have problems. For example, if you add an NSTextView to
your application's window and click in it to give it focus, you'll
suddenly find your code in the window controller is not called (because
the NSTextView consumes the event rather than passing it up the chain).
If this is an issue for you, check out NSFontPanel again. You'll see you
can change the message sent when the font changes. eg, my app sends
something like myChangeFont: instead, which I catch where I want to
catch it (looks for docs on the Responder chain) and handle. When I'm
done handling it, I find the current first responder and send a
changeFont: message to it. That way I get my shot at the message
(myChangeFont:) but the regular changeFont: message is also available to
anything that might be listening.
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.