Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How do I capture the onCloseEvent for the X?
How do I capture the onCloseEvent for the X? [message #452162] Mon, 14 March 2005 20:07 Go to next message
Eclipse UserFriend
Originally posted by: mishi_math.yahoo.com

In my shells i have exit buttons that I can handle without a problem. But
in the case of having the X in the upper right hand corner and controling
that I am stumped. I found the window "protected boolean
canHandleShellCloseEvent()" method, but not even sure how this would be
implemented and if it is even the right thing...

This is what I am looking to do, if someone has 'dirtied' the form but
they haven't saved their changes and they use the window close X button, I
want to pop up a dialog window reminding them that they haven't saved
their work and giving them the option to save or just exit.

Could someone help me please?

Regards,
Mishi
Re: How do I capture the onCloseEvent for the X? [message #452163 is a reply to message #452162] Mon, 14 March 2005 20:26 Go to previous message
Eclipse UserFriend
Originally posted by: bob.objfac.com

How about setting a ShellListener? When you get a shellClose() do your
dirty test and dialog. If the user cancels, set the doit flag in the
event to false.

Bob Foster

Mishi wrote:
> In my shells i have exit buttons that I can handle without a problem.
> But in the case of having the X in the upper right hand corner and
> controling that I am stumped. I found the window "protected boolean
> canHandleShellCloseEvent()" method, but not even sure how this would be
> implemented and if it is even the right thing...
>
> This is what I am looking to do, if someone has 'dirtied' the form but
> they haven't saved their changes and they use the window close X button,
> I want to pop up a dialog window reminding them that they haven't saved
> their work and giving them the option to save or just exit.
>
> Could someone help me please?
>
> Regards,
> Mishi
>
Previous Topic:How to transfer "virtual" objects using Clipboard or DND?
Next Topic:CTabFolder.setTopRight() with a ToolBar
Goto Forum:
  


Current Time: Fri Apr 26 02:30:27 GMT 2024

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

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

Back to the top