Re: Open document panel always on top - Mountain Lion
Re: Open document panel always on top - Mountain Lion
- Subject: Re: Open document panel always on top - Mountain Lion
- From: Charles Jenkins <email@hidden>
- Date: Thu, 09 Oct 2014 12:24:32 -0400
You need to have the document content in order to test the password, right? This might be naive, but could you load the document into an offstage memory structure (meaning, don’t plug it into the user interface yet so the user cannot see or modify it) and ask for the password only after the load completes and the Open dialog goes away. If the user gets the password right, you plug the doc into the UI; otherwise you discard the offstage memory structure.
--
Charles
On Thursday, October 9, 2014 at 10:21, Matthew LeRoy wrote:
> Good morning,
>
> My document-based application can potentially display an app-modal dialog via [NSApp runModalForWindow:] from within my override of [NSDocument readFromURL:ofType:error:], in order to prompt the user for the password to open a document. For the most part, this works just fine.
>
> The trouble I’m running into is that on Mountain Lion my password dialog is hidden behind the Open dialog, which remains open but non-responsive while my document-reading code executes (i.e. It doesn’t response to mouse clicks, can’t drag/move it out of the way to reveal the password dialog, etc). The password dialog does become key, even though I can’t see it; I can press ‘Esc’ to close it which cancels the opening process, or type the password blindly and press ‘Enter’ and, assuming I got the password right, things will proceed normally. If I switch to another application while the hidden password dialog is waiting for user input, the still-open Open dialog from my application remains on top, even on top of windows from other active applications. The Open dialog is shown via the built-in document architecture methods — I haven’t done anything to specialize it other than to modify the enabled file types by overriding [NSDocumentController beginOpenPanel:forTypes:completionHandler:] and [NSDocumentController runModalOpenPanel:forTypes:].
>
> On Mavericks, the Open dialog closes prior to my readFromURL: code executing, and so the password dialog is visible and everything is fine.
>
> Any thoughts? I’ve tried calling [NSWindow setLevel:] with NSModalPanelWindowLevel and NSStatusWindowLevel on the password dialog window prior to calling [NSApp runModalForWindow:] with no luck.
>
> Thanks!
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden (mailto: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 (http://lists.apple.com)
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden (mailto:email@hidden)
_______________________________________________
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