Displaying a sheet when plugin is loaded

3 views
Skip to first unread message

Dalquen Daniel

unread,
Mar 10, 2012, 4:10:44 PM3/10/12
to apertu...@lists.apple.com
Hello everybody,

I'm writing an export plugin that will upload to a website (another one of these...). When the plugin is opened, it checks whether the log-in information for the website could be read from the preferences. If not, I want to show a sheet where the user can enter that information.

Unfortunately, I don't seem to be able to find the correct place for

[NSApp beginSheet:loginWindow modalForWindow:[_exportManager window] modalDelegate:nil didEndSelector:nil contextInfo:nil];

as the sheet attaches to the main workspace instead of to the plugin window. When I open the sheet via a button in the GUI of the plugin, it works as expected.

Is there a way to find out, when the plugin window has been opened and the focus has changed?


Thanks!
Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Aperture-dev mailing list (Apertu...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/aperture-dev/aperture-dev%2Bgarchive-9674%40googlegroups.com

This email sent to aperture-dev+...@googlegroups.com

Steven Vandeweghe

unread,
Mar 11, 2012, 5:08:23 AM3/11/12
to Dalquen Daniel, apertu...@lists.apple.com
Hi Daniel,

Which places have you tried? Have you tried putting it in awakeFromNib?

Steven

> https://lists.apple.com/mailman/options/aperture-dev/steven%40bluecrowbar.com
>
> This email sent to ste...@bluecrowbar.com

Richard Laing

unread,
Mar 11, 2012, 5:17:31 AM3/11/12
to Dalquen Daniel, apertu...@lists.apple.com
Hi Daniel,

One option is listen for a notification when the window becomes the key window, then show the sheet, in your initWithAPIManager method add the listener.

Something like:
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(exportWindowDidBecomeKey:)
name: NSWindowDidBecomeKeyNotification
object :nil];

I hope that helps.

Richard

> https://lists.apple.com/mailman/options/aperture-dev/rlaing%40mac.com
>
> This email sent to rla...@mac.com

Richard Laing
-------------------

Dalquen Daniel

unread,
Mar 11, 2012, 11:08:00 AM3/11/12
to Richard Laing, apertu...@lists.apple.com
Hi Richard and Steven,

Thanks for your help! After sending the email to the list last night, I consulted my Cocoa book (something I should have done before...) and also found the option of listening to the notifications from the export window. So, that's what I've implemented now, and it seems to work :)

Cheers from Switzerland
Daniel

Reply all
Reply to author
Forward
0 new messages