Search code examples
gwtgxt

GWT message box with closable icon


I am using gxt(2.6) messagebox in my gwt application.. I tried this following code to keep closable icon..but its not working

Messagebox.setclosable(true);


Solution

  • Its a unfixed bug in gxt 2.6 ..I reviewed the alert() function in MessageBox.class..

    public static Messagebox alert(String title, String msg,
            Listener<MessageboxEvent> callback) {
        Messagebox box = new Messagebox();
        box.setTitle(title);
        box.setMessage(msg);
        box.callback = callback;
        box.setButtons(OK);
        box.icon = WARNING;
        box.show();
    
        return box;
    }
    

    If we add box.setClosable(true); this in existing method it will work fine

    public static Messagebox alert(String title, String msg, Listener callback) { Messagebox box = new Messagebox(); box.setTitle(title); box.setMessage(msg); box.callback = callback; box.setButtons(OK); box.icon = WARNING; box.setClosable(true); box.show();

        return box;
    }