Re: Widgets turning white and never unturning white?
Re: Widgets turning white and never unturning white?
- Subject: Re: Widgets turning white and never unturning white?
- From: glenn andreas <email@hidden>
- Date: Thu, 14 Jul 2005 08:03:50 -0500
On Jul 14, 2005, at 3:23 AM, Theodore H. Smith wrote:
I got around to looking at this:
[sheet beginSheetForDirectory:nil
file:name
modalForWindow:window
modalDelegate:self
didEndSelector:@selector
(savePanelDidEnd:returnCode:contextInfo:)
contextInfo:cfd
];
assert( true ); // just set a breakpoint here.
The open dialog fires, and then the breakpoint is trapped
immediately, even before I closed the dialog!
Which is what it is suppose to do - sheets aren't blocking (since
when a sheet is open in one window, you can still do anything you
want in a second window).
However, if I do this code:
[sheet beginSheetForDirectory:nil
file:name
modalForWindow:window
modalDelegate:self
didEndSelector:@selector
(savePanelDidEnd:returnCode:contextInfo:)
contextInfo:cfd
];
[NSApp runModalForWindow:sheet];
assert( true ); // just set a breakpoint here.
The breakpoint only files when the dialog closes.
This is bad.
I'm a bit unsure about how to get modal sheets.
That's the problem - sheets aren't modal and blocking across the
whole system. They are non-modal, and there is various architecture
in Cocoa to make them act as document modal only (so the rest of your
code continues to run for everything else).
Basically, while a sheet is up, only actions pertaining to that
sheet get done - doing things like clicking in the underlying window
do nothing except beep.
When the sheet is done, the didEndSelector is called and you continue
on with whatever you need to do, now that the user has done whatever
they've needed to in the sheet.
So basically, instead of being
- doSomething
{
set up the dialog
runModalForWindow (blocks _everything_ until complete)
process results from dialog
}
you get
- doSomething
{
set up the dialog
beginSheetForWindow: didSomething
return so system continues to treat all other windows as normal
except this one window
}
- didSomething
{
process results from dialog
}
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden