RE: How to run modal for all windows?
RE: How to run modal for all windows?
- Subject: RE: How to run modal for all windows?
- From: James Howard <email@hidden>
- Date: Fri, 18 Nov 2005 14:45:29 -0800
Turns out that the answer was right in front of my face.
Here is the solution I came up with:
+ (void)pause
{
runningModal = YES;
while(runningModal) {
NSEvent* event;
if((event = [NSApp nextEventMatchingMask: NSAnyEventMask
untilDate: [NSDate distantFuture]
inMode: NSDefaultRunLoopMode
dequeue: YES]) != nil)
{
[NSApp sendEvent: event];
}
}
}
+ (void)resume
{
runningModal = NO;
NSEvent* awaken =
[NSEvent otherEventWithType: NSApplicationDefined
location: NSMakePoint(-1.0f,-1.0f)
modifierFlags: 0
timestamp: [NSDate timeIntervalSinceReferenceDate]
windowNumber: [[NSApp mainWindow] windowNumber]
context: [NSApp context]
subtype: 0
data1: 0
data2: 0];
[NSApp postEvent: awaken atStart: NO];
}
Seems to work! :)
_______________________________________________
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