PDA

View Full Version : [FIXED] no onEnter event from KeyNav



gslender
31 May 2008, 8:31 PM
GXT build 353 GWT 1.5 RC1

The following snippet does not produce onEnter events - was working prior to GWT 1.5 RC1


package com.mycompany.gxt.client;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.util.KeyNav;
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.CenterLayout;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class LoginKeyTest implements EntryPoint {

public void onModuleLoad() {

ContentPanel cp = new ContentPanel();
cp.setHeading("Test");
cp.setSize(600,400);

LoginContainer lc = new LoginContainer();
cp.add(lc);

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

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

public class LoginContainer extends LayoutContainer
{
public LoginContainer()
{
super();
setLayout(new CenterLayout());

final FormPanel panel = new FormPanel();
panel.setHeading("Login");
panel.setFrame(true);
panel.setFieldWidth(100);
panel.setLabelWidth(80);
panel.setLabelAlign(LabelAlign.RIGHT);
panel.setButtonAlign(HorizontalAlignment.RIGHT);
panel.setWidth(270);
panel.setStyleAttribute("padding", "20");

final TextField userTxtFld = new TextField();
userTxtFld.setFieldLabel("Username");
userTxtFld.setEmptyText("Username");
userTxtFld.setAllowBlank(false);
userTxtFld.setSelectOnFocus(true);
panel.add(userTxtFld);

final TextField pwdTxtFld = new TextField();
pwdTxtFld.setPassword(true);
pwdTxtFld.setFieldLabel("Password");
panel.add(pwdTxtFld);

final Button loginBtn = new Button("Login");
panel.addButton(loginBtn);

add(panel);

new KeyNav(panel) {
@Override
public void onEnter(ComponentEvent ce) {
System.out.println("onEnter detected");
//loginBtn.fireEvent(Events.Select, new ButtonEvent(loginBtn));
}
};
}
}
}

darrellmeyer
2 Jun 2008, 9:29 PM
Fix is in SVN.

rollo
4 Jun 2008, 5:51 AM
Hello,

can you please post the solution here in the forum?

And, why i can not write in the textfileds in this snippet?

rollo