modal sessions
modal sessions
- Subject: modal sessions
- From: Devon E Bowen <email@hidden>
- Date: Sun, 7 Mar 2004 12:36:28 -0500 (EST)
I'm trying to make a non-blocking alert window. I first create a NSPanel
with:
panel = NSGetAlertPanel(title, msg, defButton, altButton, otherButton);
and set up the target/action pair in the NSButtons that are in this
NSWindow's NSView. Then I call
session = [NSApp beginModalSessionForWindow:panel];
A also create a timer to go off ever tenth of a second. And within that
timer method I do a:
if (session != nil &&
[NSApp runModalSession:session] == NSRunStoppedResponse) {
[NSApp endModalSession:session];
session = nil;
[panel close];
[timer invalidate];
}
I've got other code that works this way and it works fine. However, in
this case, when the button is clicked my button method *is* called but
*not* via the timer method. I was under the impression that once
a modal session was made, events for the window were only processed
when you call the runModalSession: method and give it a time slice. But
here it seems like the runModalSession: is redundant. Like the panel
has its own event loop or something.
The other code that I have that works this way runs fine. But in that,
I make the panel with IB and link the buttons to the methods that way
rather than programmatically via setAction: and setTarget:. So I guess
that's the difference, but I don't understand why or how to fix it. Can
anyone help here?
Devon
_______________________________________________
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.