Re: Imitating Behavior of a Sheet Window
Re: Imitating Behavior of a Sheet Window
- Subject: Re: Imitating Behavior of a Sheet Window
- From: Oleg Krupnov <email@hidden>
- Date: Sun, 24 Jan 2010 15:04:45 +0200
Hi Andy,
After some failing attempts with child windows, I followed your advice
and tried to use the standard sheets again. And this time it worked
like a charm! I've got exactly that behavior that I wanted. The focus
problem is gone, and the window buttons problem is gone. To suppress
the slide down animation, I just overrode animationResizeTime: of the
sheet window to return 0.0, that's it.
BTW, to my surprise, it appears that the standard sheets are NOT child
windows. They are implemented in some special way, not seemingly
accessible via other APIs.
Thanks a lot,
Oleg.
On Sat, Jan 23, 2010 at 12:23 AM, Andy Lee <email@hidden> wrote:
> On Friday, January 22, 2010, at 04:18PM, "Oleg Krupnov" <email@hidden> wrote:
>>Thanks Andy.
>>
>>Here's more info. The sheet is a semi-transparent nag window with some
>>text and a couple of buttons, that overlaps the main window. The sheet
>>does not have a shadow, so there is no problem to reproduce it. The
>>nag window is automatically resized together with the parent window so
>>that the nag always entirely shadows its parent.
>
> To me this sounds exactly like a view that replaces the window's content view.
>
>>What confuses me is that the standard sheet methods are obviously
>>merely a convenience for showing the sheet windows, and there must be
>>a "manual" way to do it, but I can't find it.
>
> Yeah, you would think so, especially since drawers are also child windows and they behave the way you want. I don't know much about child windows myself, but found this thread on the Omni list -- looks promising:
>
> <http://www.omnigroup.com/mailman/archive/macosx-dev/2005-August/057291.html>
>
> <http://www.cocoabuilder.com/archive/cocoa/144439-non-focused-child-window.html#144439>
>
>>
>>The window buttons of the main window are not disabled, they just
>>behave like if the window wasn't active, i.e. they appear gray, but
>>when you move the mouse over them, they light up. So I don't think
>>forcing them to enable will change anything, because they are already
>>enabled, aren't they?
>>
>>Before I switched to using the child window, I tried to use an
>>overlapping view, but I found it buggy too and quite clunky. And Cocoa
>>docs explicitly discourages using overlapping views.
>
> Depends on the target OS. I neglected to ask whether you need to support versions before Leopard. Leopard added support for overlapping sibling views. This was confirmed more than once by Apple employees on the list. The docs lagged in being updated. If you find they are still out of date you should send feedback to Apple.
>
> In any case, what you described sounds like it doesn't need overlapping views at all. You could swap out the window's entire content view for the nag view. To get the fading in and out, you might have to do some tricks like take a snapshot of the window before you remove the content view.
>
> But maybe the above links will get your child window working.
>
> --Andy
>
>
_______________________________________________
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