[NSApp stop:]
[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