PDA

View Full Version : [FIXED] Custom messagebox and callback



richard.hallier
20 Jun 2008, 7:20 AM
MessageBox box = new MessageBox();
box.addCallback(new Listener<WindowEvent>() {
public void handleEvent(WindowEvent be) {
}
});
box.setModal(true);
box.setTitle("Information");
box.setMessage("----");
box.setButtons(MessageBox.OK);
box.setIcon(MessageBox.INFO);
box.show();
This code causes a nullpointerexception because the dialog is not yet initialized. An easy fix is to replace the following code :


public void addCallback(Listener listener) {
dialog.addListener(Events.Hide, listener);
}
by


public void addCallback(Listener listener) {
this.callback = listener;
}
Richard

darrellmeyer
20 Jun 2008, 7:47 AM
This was fixed with bug http://extjs.com/forum/showthread.php?t=39139 earlier today. Fix is in SVN.