• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Running event loop while showing non-standard popup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running event loop while showing non-standard popup


  • Subject: Re: Running event loop while showing non-standard popup
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 20 May 2013 13:19:51 -0500

On May 20, 2013, at 12:00 PM, Steve Mills wrote:

> None of this code was written by me, so I don't know the reasoning behind the design. We have a popup that shows an NSWindow with an NSBrowser in it. There is a NSPopUpButtonCell subclass that handles the click with trackMouse:inRect:ofView:untilMouseUp:. This trackMouse method calls [NSApp run].
>
> When a click happens outside the browser window, it calls [NSApp stop:nil] from our NSWindowDidResignKeyNotification observer for the browser window. At that point, it seems like the app is actually trying to terminate, because all hell breaks loose - release builds crash with no crash log and debug builds crash with a stack of:
>
> #0-9 is in the dtor for one of our global objects.
> #10	0x91a1cebf in __cxa_finalize ()
> #11	0x91a1fdb9 in exit ()
> #12	0x957ba692 in NSApplicationMain ()
> #13	0x01310fb8 in main ()
>
> This leads me to believe that using run and stop: is the wrong way to do this.

Yes.

> What's another way to start and stop a "local" run loop?

-[NSApplication runModalForWindow:] and either one of the -stopModal… or -abortModal methods.  To detect a click outside of the browser window, you may need to add a local event monitor (+[NSEvent addLocalMonitorForEventsMatchingMask:handler:]) as well as monitoring the window's key status.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Running event loop while showing non-standard popup
      • From: Steve Mills <email@hidden>
References: 
 >Running event loop while showing non-standard popup (From: Steve Mills <email@hidden>)

  • Prev by Date: Running event loop while showing non-standard popup
  • Next by Date: Re: Widow / Orphan protection in text layout
  • Previous by thread: Running event loop while showing non-standard popup
  • Next by thread: Re: Running event loop while showing non-standard popup
  • Index(es):
    • Date
    • Thread