Re: Main but not Key window behavior
Re: Main but not Key window behavior
- Subject: Re: Main but not Key window behavior
- From: Quincey Morris <email@hidden>
- Date: Sat, 6 Nov 2010 13:48:16 -0700
On Nov 6, 2010, at 11:26, John Pannell wrote:
> I would like to present a utility panel in my application that becomes the key window, but not the main window. I would like the main window to maintain its active appearance, as is documented in the NSWindow docs, specifically:
>
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyWindow.html#//apple_ref/doc/uid/20000236-BCIDFJFH
>
> My desired appearance is presented in the docs as the primary reason for the key/main distinction.
>
> It seems like it should be quite easy to accomplish this, but my best efforts have come up short - making the utility panel "key" results in greyed-out close/min/zoom widgets on the "main" window. I've whipped up a demo app to show the effect: my panel is "utility" and "non-activating" in IB, and I launch it with a button to trigger a makeKeyAndOrderFront:.
AFAICT it's behaving correctly, but your expectations have be misled by the screen shot in the documentation.
Your main window *is* showing a main-window appearance after you show your panel. Note that its title bar does not gray out when your panel becomes key. It's all about expectation of 3 colors in the title bar buttons.
I believe that the color of title bar buttons is *supposed* to go to the key window, though I can't find anything in the documentation that says this. If you think about it, this makes sense, because if you Command-W in a panel that's key, the panel closes, not the main window. IOW, the "close" button is red in the window that's going to close. The above-mentioned documentation's statement about color refers, I think, to *other* UI elements, not those in the title bar.
Also, the screen shot shows a Font panel as the "key" window, but I'd say it's *not* key -- because it doesn't have colored title bar buttons. You can see this for yourself. Go to an application that uses the font panel, such as TextEdit, and bring up the Font panel. Note that its title bar buttons are gray. That's because the panel has the "becomes key only if necessary" style (which can't be set in IB, only through code) and it hasn't needed to become key yet. Now click in the Point Size field. Suddenly the close button becomes red, and the document window's title bar's buttons become gray -- because the Fonts panel just became key.
So, just go with the behavior you've got. The documentation probably deserves a bug report (and/or a request for clarification on the intended behavior).
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden