PDA

View Full Version : [FIXED] b4 dialog modal 2nd show bug



gslender
10 Jun 2008, 11:27 PM
When showing a dialog modal like, if you hide and then show again, the dialog is shown non-modal... ie the modal attribute is lost !!

Simple bug that is easily reproduced as the show() does not re-enable the modal feature that is initially done in onRender()... so I guess this needs to be adjusted.

slupix
11 Jun 2008, 1:46 AM
I also came across this bug. For now I create each time a new Dialog, but it's not a good solution. Did you find a nicer workaround?

gslender
11 Jun 2008, 1:54 AM
Yeah - I'm confused by this... isn't creating new objects for each window/dialog a "bad thing" - I thought the reason show/hide was used, was because we really should be re-using objects rather than destroying and creating... not sure why, perhaps the DOM is the problem?

gslender
11 Jun 2008, 1:39 PM
code snippet that shows problem...

1) 1st click and show is right...

2) close window using close box

3) 2nd click and show is non-modal and so you could click again (should be masked)


package com.mycompany.gxt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.FillLayout;


public class ModalDialog implements EntryPoint {

DialogWindow rw = new DialogWindow();
public void onModuleLoad() {

ContentPanel cp = new ContentPanel();
cp.setHeading("Test");
cp.setSize(600,400);
Button test = new Button("test");
SelectionListener listener = new SelectionListener()
{
public void componentSelected(ComponentEvent be)
{
rw.show();
}
};
test.addSelectionListener(listener);
cp.add(test);

final Viewport vp = new Viewport();
vp.add(cp);
vp.layout();

RootPanel.get().add(vp);
}

public class DialogWindow extends Dialog
{
public DialogWindow()
{
super();
setClosable(true);
setModal(true);
setHeading("Dialog Test");
setWidth(500);
setLayout(new FillLayout());


final FormPanel panel = new FormPanel();
panel.setHeaderVisible(false);
panel.setFieldWidth(300);
panel.setLabelWidth(100);
panel.setLabelAlign(LabelAlign.RIGHT);
panel.setButtonAlign(HorizontalAlignment.RIGHT);

final TextField firstnameTxtFld = new TextField();
firstnameTxtFld.setFieldLabel("First Name");
firstnameTxtFld.setEmptyText("Your first name");
firstnameTxtFld.setAllowBlank(false);
firstnameTxtFld.setSelectOnFocus(true);
panel.add(firstnameTxtFld);

final TextField lastnameTxtFld = new TextField();
lastnameTxtFld.setFieldLabel("Last Name");
lastnameTxtFld.setEmptyText("Your last name");
lastnameTxtFld.setAllowBlank(false);
lastnameTxtFld.setSelectOnFocus(true);
panel.add(lastnameTxtFld);

final TextField emailTxtFld = new TextField();
emailTxtFld.setFieldLabel("Email");
emailTxtFld.setEmptyText("A valid email address");
emailTxtFld.setAllowBlank(false);
emailTxtFld.setSelectOnFocus(true);
panel.add(emailTxtFld);

add(panel);
}
}
}

darrellmeyer
11 Jun 2008, 3:24 PM
Fix is in SVN.