Imitating Behavior of a Sheet Window
Imitating Behavior of a Sheet Window
- Subject: Imitating Behavior of a Sheet Window
- From: Oleg Krupnov <email@hidden>
- Date: Fri, 22 Jan 2010 21:27:20 +0200
I'd like to create a window that would behave exactly as a sheet,
except that it doesn't slide down from the window title bar, but fades
in instead. The "sheet" should be modal, but the parent window should
still be resizable and closable.
For this reason (and also some others), I can't use [NSApp beginSheet:
modalForWindow: modalDelegate: didEndSelector:]
So I created the sheet window and used [NSWindow
addChildWindow:ordered: ] to add it to the parent so that the sheet
would move together with the parent.
Next, I tried to use [NSApp runModalForWindow:], but in this case the
parent window becomes not resizeable and not closeable -- any click on
the parent window simply causes the beep sound while the sheet is
showing. This is not how the "natural" sheet window works though.
So I ended up with simply overriding canBecomeKeyWindow in the parent
window to return "NO" and also overriding canBecomeKeyWindow in the
sheet window to return "YES" and then making the sheet window the key
window.
This works perfectly except for a single little problem. The title bar
of the parent window and its "traffic light" window buttons are grayed
our like if the parent window wasn't key window (which is true
though).
However, when a "natural" sheet is showing, the title bar of the
parent window and the "traffic light" buttons are displayed normally,
as if the parent window was the key window, even though the key focus
is inside the sheet window.
What is the trick I am missing that allows the natural sheet window to
behave like this?
Thanks
_______________________________________________
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