PDA

View Full Version : FormPanel default key action


gslender
04-25-2008, 06:25 PM
Hi,

How would you enable default "enter" key action on a FormPanel.

Previosuly (0.52) I used the following code which work on GWT textfields etc...


KeyboardListenerAdapter kla = new KeyboardListenerAdapter()
{
public void onKeyPress(Widget sender, char key, int mods)
{
if (KeyboardListener.KEY_ENTER == key)
{
loginBtn.fireEvent(Events.Select);
System.out.println("click");
}
}

};
userTxtFld.addKeyboardListener(kla);
pwdTxtFld.addKeyboardListener(kla);

... now I can't find key listening events when using GXT fields to get the key codes from BaseEvent ??

catchbox
04-26-2008, 06:25 AM
You can use KeyNav...see in code snippet.


new KeyNav(formLogin){
@Override
public void onEnter(ComponentEvent ce){
Info.display("Enter", "formLogin pressed");
}
};

gslender
04-26-2008, 07:05 PM
Thankyou very much - really need to look through the docs more to find new things !! ;)