Re: Difference between Main and Key attribute for a window
Re: Difference between Main and Key attribute for a window
- Subject: Re: Difference between Main and Key attribute for a window
- From: j o a r <email@hidden>
- Date: Tue, 10 Dec 2002 10:37:05 +0100
In the simple case, main- and key windows are one and the same.
Now, I assume that you have used inspector panels - for instance the
ones found in Interface Builder, the "Get Info" windows in Finder, the
toolbar palette in PhotoShop, etc..? When you use inspector windows you
need to be able to know what to inspect, right? The inspector panel is
somehow associated with the contents of some other window. In Cocoa
this association is managed by the relationship between the key and
main window. i.e.. the objects to inspect are generally found in the
main window - usually the active document window.
So, the key window is the window with the selected control (i.e.. a
text field with the cursor), or the last clicked window that accepts to
be key window (responds YES to the canBecomeKeyWindow method). The key
window need not be the same thing as the main window, but can be.
If you click on a window that can become key, but cannot become main -
like subclasses of NSPanel, this window will get to be key window, but
main window will still be the last selected window that accepts to be
main window (responds YES to the canBecomeMainWindow method).
IIRC, In the OpenStep days the key window had a black title bar, the
main window had a dark grey title bar and remaining windows had light
grey title bars. In Mac OS X things are less clear, sometimes both main
and key windows have enabled "traffic lights", some times not.
Behaviour seems to differ between not only Carbon and Cocoa apps, but
also from app to app.
j o a r
On Tuesday, Dec 10, 2002, at 09:46 Europe/Stockholm, Arnaud Forgiel
wrote:
I spent almost all my evening yesterday looking in the Apple
documentation for a clear definition of main and key windows. I
understand what a key window is, but I'm really struggling with the
"main" aspect. What does it do? What kind of additional behavior does
it bring?
I hope my question doesn't look too stupid to you:-)
_______________________________________________
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.