Re: sheet comes unglued from its window
Re: sheet comes unglued from its window
- Subject: Re: sheet comes unglued from its window
- From: Matt Neuburg <email@hidden>
- Date: Fri, 20 Sep 2002 07:04:31 -0700
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!!
(3)
One reader proposed, offline, that the Apple docs were wrong; when you use
this approach, you don't runModalForWindow: on the sheet, as Apple claims,
but on the doc window to which it is attached. That makes no sense to me,
but I tried it and it worked! That solves problem (2). But now there's a
new interface problem; at the moment of the runModalForWindow call (that
is, just after the sheet has appeared), there is a dreadful flash: the doc
window momentarily comes in front of the sheet, it seems, and then retires
again. I'd like to get rid of that flash.
Thanks for any help. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.