• 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
Re: Better way to deal with NSFontPanel in a preference pane
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Better way to deal with NSFontPanel in a preference pane


  • Subject: Re: Better way to deal with NSFontPanel in a preference pane
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Sun, 15 Feb 2004 21:46:24 -0800

Hello...

First, have you tried adding a changeFont: method to your view that is put into the Main window for your preference pane? That view (which contains the button) should be in the responder chain at that point, so it should get the changeFont: message from the Font Panel and be able store the font however it needs to...

Also, if I remember correctly, what Apple usually does is have an NSTextField that displays the name and size of the currently selected font. It's possible that when you click the "Set Font":button what they do is make the NSTextField the first responder so that it would recieve the -changeFont: message from the font panel, and then the font can be obtained the NSTextField...

I would also point out that whatever Apple does, it doesn't always work correctly for them either :)
I've run into situations where the font refuses to change no matter what I do to the font panel, until all of a sudden it starts working again (for example, setting/changing the font in the Terminal.app "Window Settings...", sometimes it works, sometimes it doesn't)

Hope that helps,

Louis

This isn't a problem in the sense that I have no solution to it, but it's nagging at me because of the hack I had to do to make it work.

Basically, I have a button in my preference pane that shows the Font panel. The Font panel, on user selection, sends a -changeFont: message up the responder chain. I need it to send the message to a delegate, because the idea is to store a font and size (and attributes etc.) for later use by the faceless background app the pane controls. Since I don't have direct access to the responder chain for System Preferences, naturally, my solution was to create a subclass of NSResponder, manually insert it into the responder chain (just before [NSApp mainWindow] and set its nextResponder to the original one), and have it call back into my pane controller.

This works reliably, but it feels like a hack. Is there a better way to pick a font for later use? I don't want to have to implement a font menu, a size menu, an attributes menu... that's what the font panel is for!

-- Sailor Quasar, just another player in The World
"Come with me in the twilight of the summer night for awhile"
Email: email@hidden
_______________________________________________
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.

References: 
 >Better way to deal with NSFontPanel in a preference pane (From: Sailor Quasar <email@hidden>)

  • Prev by Date: Re: NSImage and flipping
  • Next by Date: Re: General Question: Debugging these "NS" Objects: Answered
  • Previous by thread: Re: Better way to deal with NSFontPanel in a preference pane
  • Next by thread: ScalingScrollView with Sketch
  • Index(es):
    • Date
    • Thread