Code:
DynamicForm frmLogin = new DynamicForm(); TextItem txtUsuario = new TextItem("usuario", "Usuario"); txtUsuario.setTabIndex(0); txtUsuario.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if ("Enter".equals(event.getKeyName())) { frmLogin.focusInItem(cmbOficina); } } });
If you don't know what's the next control (in a base class, for example) you can use the event getForm() method like this
Code:
event.getForm().focusInItem(event.getItem().getTabIndex()+1);
The previous code isn't aware when it is the last control. Most of the time, we would like to fire the OK button.