[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: How to handle window closing event?

In article <ct04ck$l4g$1@xxxxxxxxxxxxxxx>, v@xxx says...
> > How do we trap this event?
> 
> > And, is there a way to abort closing a window?
> 
> Bill, have you ever considered using the search
> (http://www.eclipse.org/search/search.cgi) ?
> 
> you seem to come accross a lot of 'problems' that are frequently asked
> around here.
> 
> just a suggestion.

But anyway here's a short example adapted from a project I'm working on:

shell.addShellListener(new GuiAdapter());
...
private class GuiAdapter extends ShellAdapter
{
	public void shellClosed(ShellEvent e)
	{
		if (!checkQuit())
			e.doit = false; // Don't close gui!
		else
			controller.shutdown();

	}
}

Another suggestion: Before you start using JFace and/or a GUI builder 
it's perhaps a good idea to try and write some SWT gui's by hand. Just 
to get a feel for how it works.
-- 
  Regards Max    rotvel AT bolignet-aarhus DOT dk