Re: modal windows (again)
Re: modal windows (again)
- Subject: Re: modal windows (again)
- From: Allan Odgaard <email@hidden>
- Date: Tue, 9 Mar 2004 14:52:33 +0100
On 9. Mar 2004, at 11:32, Devon E Bowen wrote:
I asked about this problem and didn't get an answer. [...]
This is a high-traffic list, a subject like "Modal windows" are not
going to attract much attention.
Basically, I'm simply trying to make an non-blocking alert panel. I
do the following:
panel = NSGetAlertPanel(title, msg, defButton, altButton,
otherButton);
Modal is the opposite of non-blocking -- if you want a non-blocking
panel to appear, you should not use a function which returns a window
prepared for a modal session.
You'd normally use IB to create non-blocking panels.
When you invoke [runModalSession], events for the NSWindow of this
session are dispatched as normal. This method returns when there
are no more events. You must invoke this method frequently enough
that the window remains responsive to events.
So I would expect to have to run this method inside of a timer that
goes of frequently or something. But apparently, this isn't really
how it works. Can someone explain this? I'm getting desparate.
This method is for the case where e.g. you'd need to do a lot of work
in the main thread but still wants your GUI to be responsive, so you'd
call it in a local loop, e.g.
session = [NSApp beginModalSessionForWindow:aWindow];
while(stuffToBeDone() && [NSApp runModalSession] ==
NSRunContinuesResponse)
doStuff();
[NSApp endModalSession:session];
_______________________________________________
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.