• 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: Dismissing Open dlog before doc actually opens
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dismissing Open dlog before doc actually opens


  • Subject: Re: Dismissing Open dlog before doc actually opens
  • From: Steve Mills <email@hidden>
  • Date: Wed, 14 Aug 2013 11:02:18 -0500

On Aug 14, 2013, at 10:52:55, Graham Cox <email@hidden>
 wrote:

> The only other thing you might try is running the run loop a few cycles in your completion handler so that the orderOut: is processed. It might have unexpected side-effects though, which might also reveal a very good reason why it's not done by default. For example, this works to close the panel immediately:
>
> 		NSOpenPanel*			p = [NSOpenPanel openPanel];
>
> 		if([p runModal] == NSFileHandlingPanelOKButton)
> 		{
> 			[p orderOut:self];
>
> 			[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
>
> 			// Simulate code that takes 5 seconds to open a document:
> 			sleep(5);
> 		}


I was trying something similar, but instead was using [NSApp [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO];

Which didn't work alone, so I added a 2nd:

[NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0.3] inMode:NSDefaultRunLoopMode dequeue:NO]

Which worked about half the time.

I just tried your method of runUntilDate with a time of 0.1 in the future and so far it's working every time. Thanks for that - I wasn't aware of this method. We'll give it a thorough testing.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157




_______________________________________________

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: Dismissing Open dlog before doc actually opens
      • From: Bryan Vines <email@hidden>
References: 
 >Dismissing Open dlog before doc actually opens (From: "Mills, Steve" <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Bryan Vines <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Steve Mills <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Kyle Sluder <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Steve Mills <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Kyle Sluder <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Steve Mills <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Roland King <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Steve Mills <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Alex Zavatone <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Steve Mills <email@hidden>)
 >Re: Dismissing Open dlog before doc actually opens (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Dismissing Open dlog before doc actually opens
  • Next by Date: Re: Dismissing Open dlog before doc actually opens
  • Previous by thread: Re: Dismissing Open dlog before doc actually opens
  • Next by thread: Re: Dismissing Open dlog before doc actually opens
  • Index(es):
    • Date
    • Thread