On 5 Oct 2013, at 12:28, Jim Elliott <sjameselli...@me.com> 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com