Search code examples
gwtgxt

Handle Window close event


I'm trying to handle the event when the close button of a Window is clicked:

// View Code
@Override
public void attachWindowListener(WindowListener listener) {
    window.addWindowListener(listener);
}

// Presenter code
    view.attachWindowListener(new WindowListener(){
          public void windowHide(WindowEvent we) {
              GWT.log("Window Event - Processing fields");
              processFields();
          }         
    });

However, the windowHide function seems to be not executed since I can't see the log I placed there.

How to properly handle that event?


Solution

  • This worked:

        window.addListener(Events.Hide, new Listener<ComponentEvent>() {
            @Override
            public void handleEvent(ComponentEvent be) {
              // Do stuff
            }
        });