re: setLevel: window and drawers
re: setLevel: window and drawers
- Subject: re: setLevel: window and drawers
- From: Bill Cheeseman <email@hidden>
- Date: Sun, 22 Dec 2002 14:13:14 -0500
I found a solution.
A strategy that guarantees a closed floating-level drawer window won't
become visible on top of the parent window when the parent window's level is
changed from floating to normal is this: Set all drawer windows to normal
level whenever the parent window's level is changed either way, and use
NSDrawer's drawerWillOpen: and drawerWillClose: delegate methods to set a
specific drawer to the parent window's current level just before the drawer
is opened and back to normal level just before the drawer is closed. Drawers
still flash briefly when setting the parent window to floating level if a
drawer has been opened once previously at the floating level; I can't find a
way to prevent this.
This does require accessing NSDrawer's private _drawerWindow iVar. It
therefore risks trouble in the future if Apple changes the underlying
implementation of drawers.
There must be some very funky stuff going on under the hood to control
drawers. There seem to be two awkward things happening down there: (1) a
drawer window's level is apparently set to the parent window's level at one
or more places in the process, and I don't know where; and (2) changes to a
drawer window's level apparently don't take effect until a specific place in
the process (either opening or closing the drawer, or both). The trick is
to catch the right places in the process to change the drawer window's level
back to what I want. Coding by trial-and-error is so much fun!
I would guess that Apple never considered the possibility somebody would
want to write a panel having drawers and that could be changed between
floating and normal levels on the fly. But it's the perfect solution to my
application.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
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.