• 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
[NSApp stop:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NSApp stop:]


  • Subject: [NSApp stop:]
  • From: Michiel de Hoon <email@hidden>
  • Date: Thu, 9 Oct 2008 06:15:18 -0700 (PDT)

Hi everybody,

According to the documentation, [NSApp stop:] will break the flow of control out of the [NSApp run] method.  While this is true, [NSApp run] doesn't notice that [NSApp stop:] was called until some other event comes along.  So I call [NSApp stop:], nothing happens, and when I then move the mouse over one of the application windows [NSApp run] exits.  Currently my workaround is to post a do-nothing event to NSApp to wake up the runloop:

    [NSApp stop: nil];
    NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
                                        location: NSMakePoint(0,0)
                                   modifierFlags: 0
                                       timestamp: 0.0
                                    windowNumber: 0
                                         context: nil
                                         subtype: 0
                                           data1: 0
                                           data2: 0];
    [NSApp postEvent: event atStart: true];

Then [NSApp run] exits immediately.
But there must be a better way to do this. Does anybody know what the right way is to do this?

Thanks,

--Michiel.




_______________________________________________

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: [NSApp stop:]
      • From: "Michael Ash" <email@hidden>
    • Re: [NSApp stop:]
      • From: Jason Coco <email@hidden>
  • Prev by Date: How can be my application notified about user defaults changes?
  • Next by Date: AddressBook (Repost from objc-language)
  • Previous by thread: Re: How can be my application notified about user defaults changes?
  • Next by thread: Re: [NSApp stop:]
  • Index(es):
    • Date
    • Thread