pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: Dialog During Shutdown
Date Thu, 22 Oct 2009 22:23:43 GMT
Hi Scott,

First off, you can only do this in DesktopApplicationContext, since
BrowserApplicationContext can't reliably prevent the applet from getting
destroyed.  If you are in DesktopAplpicationContext, then the very short
answer is that you return true from Application.shutdown() to prevent the
shutdown until the user has answered your question.  Then, when they answer
your dialog (or sheet), you call DesktopApplicationContext.exit(), and allow
the shutdown at that time.

The long answer is that it's kinda tricky to get right.  To aid you on your
way, I'll blindly paste snippets of the source of my Pivot app that does
exactly this - you should be able to gleam what you need from it.

I've attached two snippet source files.  Let me know if they don't come
through.

-T

On Thu, Oct 22, 2009 at 5:58 PM, Scott Lanham <lists@sael.com.au> wrote:

> Hi All,
>
> I am at the point in my application where during Application.shutdown I
> would
> like a dialog to popup if they haven't saved their changes. The dialog
> would
> ask if they want to Save, Not Save, Cancel with the last cancelling the
> shutdown. I am uncertain of how to approach this and was hoping someone
> could
> give me some guidance :-)
>
> Thanks,
>
> Scott.
>

Mime
View raw message