PDA

View Full Version : Confirmation before window close



okwei
15 Oct 2008, 3:39 PM
Hi,

Is there a way to prompt the user a confirmation when the user clicks on the 'x' of a Window?

The windowclose event fires after the window is close, when I catch that, it's too late..

thanks,

gslender
15 Oct 2008, 7:04 PM
From the FAQ - use the event.doit=false in a window listener and then add/remove that listener depending on the answer.

cheers,
grant

djakette
21 Oct 2008, 4:58 AM
Well i try to do that but i don't know the name of the event :

I try that :

win.addListener(Events.beforeclose, new Listener<WindowEvent>() {
public void handleEvent(WindowEvent we) {
we.doit = false;
}

});

But it's not working.
What's wrong ?

okwei
23 Oct 2008, 3:49 PM
Well i try to do that but i don't know the name of the event :

I try that :

win.addListener(Events.beforeclose, new Listener<WindowEvent>() {
public void handleEvent(WindowEvent we) {
we.doit = false;
}

});

But it's not working.
What's wrong ?


It works for me, do you setCloseAction(CloseAction.CLOSE);? i guess by default the hidden action when you try to close the window.