Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Halting a dispose
Halting a dispose [message #456044] Wed, 25 May 2005 03:16 Go to next message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Is there any way to catch a dispose event, and in specific cases have it
not dispose (such as in the Are you sure? dialog in many programs)?

-Matt
Re: Halting a dispose [message #456138 is a reply to message #456044] Wed, 25 May 2005 13:27 Go to previous messageGo to next message
Max Rotvel is currently offline Max RotvelFriend
Messages: 21
Registered: July 2009
Junior Member
On Wed, 25 May 2005 05:16:40 +0200, <user@domain.invalid> wrote:

> Is there any way to catch a dispose event, and in specific cases have it
> not dispose (such as in the Are you sure? dialog in many programs)?

No, but if want to prevent your app from closing you can add a
ShellListener to your Shell and show your "Are you sure?" dialog in the
shellClosed() method:

shell.addShellListener(new ShellAdapter()
{
public void shellClosed(ShellEvent e)
{
if (["Are you sure?" dialog returns 'No'])
e.doit = false;
}
});

Regards
--
Max - rotvel AT bolignet-aarhus DOT dk
Re: Halting a dispose [message #456181 is a reply to message #456138] Thu, 26 May 2005 04:50 Go to previous messageGo to next message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Max Rotvel wrote:
> On Wed, 25 May 2005 05:16:40 +0200, <user@domain.invalid> wrote:
>
>> Is there any way to catch a dispose event, and in specific cases have it
>> not dispose (such as in the Are you sure? dialog in many programs)?
>
>
> No, but if want to prevent your app from closing you can add a
> ShellListener to your Shell and show your "Are you sure?" dialog in the
> shellClosed() method:
>
> shell.addShellListener(new ShellAdapter()
> {
> public void shellClosed(ShellEvent e)
> {
> if (["Are you sure?" dialog returns 'No'])
> e.doit = false;
> }
> });
>
> Regards

It worked. Thank you!

-Matt
Re: Halting a dispose [message #456358 is a reply to message #456138] Wed, 01 June 2005 09:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bogdan.nowhere.com.pl

Max Rotvel wrote:

> No, but if want to prevent your app from closing you can add a
> ShellListener to your Shell and show your "Are you sure?" dialog in the
> shellClosed() method:

> shell.addShellListener(new ShellAdapter()
> {
> public void shellClosed(ShellEvent e)
> {
> if (["Are you sure?" dialog returns 'No'])
> e.doit = false;
> }
> });

I'm trying this with my app on Pocket PC but it doesn't work well.
When I'm closing shell programaticaly: shell.close(), I can see dialog and
denied app closing,
but when I'm closing dialog with close button from title bar dialog
doesn't show and application is halting - all shells disapear and no clean
up is done.?
Re: Halting a dispose [message #456365 is a reply to message #456358] Wed, 01 June 2005 13:24 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Please enter a bug report with a stand alone example that shows the problem.

"bogdan" <bogdan@nowhere.com.pl> wrote in message
news:05011551fc4ea4c5abdeada2199c854f$1@www.eclipse.org...
> Max Rotvel wrote:
>
> > No, but if want to prevent your app from closing you can add a
> > ShellListener to your Shell and show your "Are you sure?" dialog in the
> > shellClosed() method:
>
> > shell.addShellListener(new ShellAdapter()
> > {
> > public void shellClosed(ShellEvent e)
> > {
> > if (["Are you sure?" dialog returns 'No'])
> > e.doit = false;
> > }
> > });
>
> I'm trying this with my app on Pocket PC but it doesn't work well.
> When I'm closing shell programaticaly: shell.close(), I can see dialog and
> denied app closing,
> but when I'm closing dialog with close button from title bar dialog
> doesn't show and application is halting - all shells disapear and no clean
> up is done.?
>
>
>
Previous Topic:Please Help: Detecting swt-composite via mouse-event
Next Topic:Noob Table with ScrollBar question
Goto Forum:
  


Current Time: Sat Apr 27 01:25:45 GMT 2024

Powered by FUDForum. Page generated in 0.03070 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top