public static interface Window.DeleteEvent
If you want to prevent a Window from being closed, connect this signal,
and return true
. Often the reason to do this is to pop up
a notification Dialog, for example asking you if you want to save an
unsaved document. Another technique is reusing a Window: rather than
going to all the trouble to create this Window again, you can just
temporarily hide it by calling Widget's hide()
.
Likewise, if you are going to take a long time to tear down the
resources used by the Window or application as a whole (often the case
when the user clicks on the [X]
button in the window
decorations), it is a good idea to call hide()
immediately. Many window managers will popup a warning dialog asking
you if you want to force-terminate the application if a window is
perceived to be "unresponsive" to a close request. You can avoid this
by simply hiding the Window while you clean up.
This signal is actually "delete-event" which lives on GtkWidget. That, however, is for implementation reasons in GTK because all the GdkEvents go to GtkWidget even though this particular signal only has to do with Windows. So, we expose it here.
Modifier and Type | Method and Description |
---|---|
boolean |
onDeleteEvent(Widget source,
Event event) |