Folks,

I need help figuring out this problem.  Basically, I want to run a
WebView in a modal dialog, but WebView's don't work in
NSModalPanelRunLoopMode.  So, I have been trying unsuccessfully to
fake a modal run loop while running it in NSDefaultRunLoopMode.  This
is my latest attempt:

  // Leave all appkit defined and system events on the queue.  This will make
  // sure the app activates correctly when running this loop from within
  // -applicationDidFinishLaunching.
  unsigned int eventMask = NSAnyEventMask &
      ~(NSAppKitDefinedMask|NSSystemDefinedMask|
        NSApplicationDefinedMask|NSPeriodicMask);
  while (inModalLoop_) {
    NSEvent *event = [NSApp nextEventMatchingMask:eventMask
                                        untilDate:[NSDate distantFuture]
                                           inMode:NSDefaultRunLoopMode
                                          dequeue:YES];
    if (event != nil && [event window] == window_) {
      [NSApp sendEvent:event];
    }
  }

|inModalLoop_| is set to FALSE when the "modal" panel is dismissed.
Several problems arise with this method:

1. I want my app to effectively stall - that is, don't process any
events - while this modal window is up.
2. The modal window is ordered onscreen during
-applicationDidFinishLaunching:, so even though I want event
processing to appear modal to the window, I still need to let certain
events through so that the app will continue to activate correctly,
etc. once the panel is dismissed.
3. On Tiger, my method produces all kids of odd behavior, such as
button clicks in the window not causing notifications to get sent
(windowDidClose: in particular).

Basically, it appears that my method screws up the event system pretty badly.

Clearly my approach is bogus.  Should I be using a runloop for this?
If so, what mode do I run it in?

Help?

Thanks!
- Dave.S
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to