Re: sheet comes unglued from its window
Re: sheet comes unglued from its window
- Subject: Re: sheet comes unglued from its window
- From: Andy <email@hidden>
- Date: Sun, 22 Sep 2002 09:53:03 -0400
Matt Neuburg wrote:
>
>
I'm not getting any answers here, and release is later today, so in
>
desperation I'm cross-posting; sorry about that.
>
>
Okay, let me restate the problem. It comes in three parts.
>
>
(1)
>
>
I'm trying to modularize the code that puts up a sheet. In other words I
>
want to treat this code as a function; in class A, I call a method in class
>
B which puts up the sheet, controls things while the sheet is up, controls
>
the putting down of the sheet, and after the sheet is gone, returns a value
>
back to A.
>
>
If anyone has any suggestions on how to do this, that would be a big help.
>
I couldn't find one, because sheet control is distributed over multiple
>
functions; if I start by calling method 1, sheet control ends up in method
>
2, and method 2 can't reply to a call to method 1. In fact, by this time
>
method 1 has exited.
>
>
(2)
>
>
Hunting around for a solution, I was struck by the peculiar structure of
>
the example in Apple's docs, in UsingCascadingSheets.html:
>
>
> [NSApp beginSheet: moreInfoSheet
>
> modalForWindow: window
>
> modalDelegate: nil
>
> didEndSelector: nil
>
> contextInfo: nil];
>
> [NSApp runModalForWindow: moreInfoSheet];
>
> // Sheet is up here.
>
> [NSApp endSheet: moreInfoSheet];
>
> [moreInfoSheet orderOut: self];
>
>
I had never thought of using *both* beginSheet *and* runModalForWindow. Yet
>
here is Apple acting like this is the normal thing to do. Well, since
>
runModalForWindow blocks the method in which it is called until modality
>
ends, this, I thought, would solve problem (1) for me. So I tried it.
>
Structurally, it works! But from an interface point of view it's a
>
disaster; while the sheet is up, if I click on another window, I'm able to
>
switch to it! And at the same time the sheet continues to hover,
>
disembodied and disconnected from its window, over top of everything!!
>
I was also seeing this exact same behaviour (disconnected sheets), in
similar circumstances - ie, I wanted sheet with both beginSheet: and
runModalForWindow:
It turned out to be related to the window's attributes as set in
Interface builder. The only 2 flags I have on on my sheets are
"Deferred" and "One Shot". I don't recall exactly, but I believe I also
had "Hide on deactivate" switched on, and it was turning this off that
fixed the problem with the sheets becoming detached. Could have been one
of the other flags though...
--
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy ...)
_______________________________________________
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.