• 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: Modal Alert Sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modal Alert Sheet


  • Subject: Re: Modal Alert Sheet
  • From: "email@hidden" <email@hidden>
  • Date: Sun, 06 Oct 2013 12:34:47 +0100


On 5 Oct 2013, at 12:28, Jim Elliott <email@hidden> wrote:

> An odd thing is happening when I invoke the NSAlert method beginSheetModelForWindow:modalDelegate:didEndSelector:conextInfo.  It seems that the method returns before calling and returning from the didEndSelector.
>
This is not odd, its expected. This method returns immediately unlike NSApplication -runModalForWindow which sets up a modal event loop.
The sheet is modal for the window only. If it blocked the run loop then no events would be delivered to any other window.

> To be more specific, I have subclassed the NSDocument method canCloseDocument: because I have some additional cleanup to do before the document window goes away.  If the cleanup is needed, I create an alert sheet and asks the user if he wants the cleanup performed.  After calling beginSheetModalWithWindow, I then invoke canCloseDocument on super.
>
I would do something like set a document level cleanupDone flag.
If cleanupDone is NO then show the sheet and return NO in -canCloseDocument.
In the didEndSelector method test if cleanup was successful. If so set the flag to YES and close the document again.
- canCloseDocument can now return YES based on the flag status.

HTH

Jonathan
_______________________________________________

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


References: 
 >Modal Alert Sheet (From: Jim Elliott <email@hidden>)

  • Prev by Date: Modal Alert Sheet
  • Next by Date: Re: Runloops and Window Dragging
  • Previous by thread: Modal Alert Sheet
  • Next by thread: High-quality offscreen rendering of text?
  • Index(es):
    • Date
    • Thread