Re: NSPanel vs. NSFontPanel and font color
Re: NSPanel vs. NSFontPanel and font color
- Subject: Re: NSPanel vs. NSFontPanel and font color
- From: Tom Harrington <email@hidden>
- Date: Wed, 26 Oct 2005 09:47:48 -0600
On 10/25/05, Erik Buck <email@hidden> wrote:
> Actually, I don't think changing font and color are supposed to work
> in a text field, NSTextField, on a panel or on any other kind of
> window. Perhaps the original poster means an editable NSTextView ?
>
> Am I missing something ?
Yes, I did mean NSTextView.
> I just built a no-code interface builder application with NSPanels
> containing text views. I added the standard Format menu. I build
> and run. Setting fonts and colors works fine while editing the text
> views in panels even without calling -setWorksWhenModal:.
OK, I created a new app using the "Cocoa Application" template.
Opened MainMenu.nib and added an NSTextView to the NSWindow that the
project template includes. I added an NSPanel with its own
NSTextView. I also made sure that both the panel and window were
visible at launch, and added the standard Format menu. No other
changes to the project template.
When I build and run the application I can set the font style and size
in both NSTextViews. I can set the text color in the NSTextView
that's in the NSWindow-- select text, bring up the font panel, click
the text color button, and then select a color from the color
selector.
If I try the same sequence for the NSTextView that's located in the
NSPanel, the NSPanel loses focus as soon as the color-selection panel
(presumably an NSColorPanel?) appears. Color change events are
apparently not received by this NSTextView, because the color doesn't
change.
But if I then click in the NSPanel's NSTextView while the color
selector is visible, color changing does work. This extra step is not
necessary with the NSWindow's text view.
I'm guessing that the appearance of the color-selection panel causes
my NSPanel to drop out of the responder chain, and that clicking in
the panel brings it back in. But I don't want the extra step to be
necessary, so I guess what I really need is a way to intercept the
color change somewhere and redirect it back to the NSTextView that
should be receiving it. Or is there some better way?
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden