• 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: How to run modal for all windows?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Distributed Objects - which frameworks?
  • Next by Date: Re: Distributed Objects - which frameworks?
  • Previous by thread: How to run modal for all windows?
  • Next by thread: Distributed Objects - which frameworks?
  • Index(es):
    • Date
    • Thread