I am developing a SDI web app using SmartGwt. In the main window, I want to popup a Window, when a button is clicked. However when the popup Window is closed, the main window is not able to trap the event. Is there any good way to do that?
IButton showPopupButton = new IButton();
showPopupButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Window popup = new Window();
popup.show();
SC.say("The popup was closed"); // UNEXPECT: It shows up just after the popup is shown.
}
});
Currently, I can declare an argument BooleanCallback into the constructor, so that when the popup window is going to be closed, it should call the callback function.
I have a solution:
IButton showPopupButton = new IButton();
showPopupButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Window popup = new MyWindow(new BooleanCallback() {
public void execute(Boolean value) {
SC.say("The popup was closed");
}
});
popup.show();
}
});
But if someone else writes a plugin for me and does not using such "callback function" into its constructor, how to track Window close event? I tried to register a VisiblityChangedHandler to the popup window, but it does not work.
Window closing handler event catch closing event, Try with
Window.addWindowClosingHandler(new ClosingHandler() {
@Override
public void onWindowClosing(ClosingEvent event) {
}
});