简体   繁体   中英

How to track Window close of SmartGwt

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) {


            }
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM