• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Intercepting NSPanel's changeFont: message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Intercepting NSPanel's changeFont: message


  • Subject: Intercepting NSPanel's changeFont: message
  • From: Glenn Howes <email@hidden>
  • Date: Fri, 24 Jan 2003 13:08:10 -0600

Hello,
The quote below was from a posting back in November. Could someone explain to me how one changes the message NSFontPanel sends out when a font changes? Or barring that how to prevent a selected NSTextField from hogging the message. I've inserted an NSResponder subclass at the top of the responder chain so I get the message when the NSTextField is not selected.


--glenn


On Tuesday, November 26, 2002, at 09:20 PM, Andy wrote:


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.
_______________________________________________
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.

  • Prev by Date: Re: DSP framework for Cocoa
  • Next by Date: Re: Handling NSWorkspace: -openUrl: message?
  • Previous by thread: Re: NSBrowser: so very, very broken
  • Next by thread: IOKit problems with USB IR device
  • Index(es):
    • Date
    • Thread