Deactivating Windows for Modal Event Loop
Deactivating Windows for Modal Event Loop
- Subject: Deactivating Windows for Modal Event Loop
- From: "Josh Ferguson" <email@hidden>
- Date: Tue, 27 Dec 2005 15:32:57 -0600
- Thread-topic: Deactivating Windows for Modal Event Loop
I'm currently writing a framework that requires that I display a "modal"
window containing a WebView when a specific function is called. Because
the window contains a webview, and because it may spawn other windows, I
can't use any of the runModal... NSApp methods, so I have to write my
own modal event loop. Currently, my loop looks something like this:
If(!_done && (event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode
dequeue:YES]))
{
// I maintain an array of "active" windows that should accept
events
If([windowArray containsObject:[event window]])
[NSApp sendEvent:event];
Else if([event type] == NSAppKitDefined || [event type] ==
NSSystemDefined)
[NSApp sendEvent:event];
}
This is working great except for a couple of small issues:
1.) The 'background' window (i.e. the window of the application calling
into the framework) doesn't get deactivated. I want all the controls to
become deactivated like they are in a regular modal session. To further
complicate matters, this framework may be called from a Carbon
application. I've looked at calling -[NSApplication windows] to get all
the existing windows prior to displaying the framework window, but I'm
not sure how to "deactivate" the windows. Any suggestions?
2.) Occassionally, it appears that the window I display never get's
"active". In other words, if I'm, say, stepping through the debugger at
the time the window is displayed, when I switch back to the application
that called my framework to display the window, all the controls
remained greyed out, even though the window accepts events and functions
just fine. Is there a call I can make to ensure that the controls don't
become deactivated in this window? (in other words, they stay blue when
they're supposed to be blue). I'm not sure if I'm using the proper
terminology here.
Is there a certain event mask or something that I can intercept and then
ensure that these windows do in fact stay in the proper "activated" or
"deactivated" state?
Thanks for your help.
Josh Ferguson
_______________________________________________
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