Using setEditable(false) and setForceSelection(true) and extending the class, you can do it yourself (watching the keystrokes on widgets).
First subclass:
package net.binarymuse.gwt.gxt.client; import com.extjs.gxt.ui.client.event.ComponentEvent; import com.extjs.gxt.ui.client.event.KeyListener; import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; public class MySimpleComboBox<T extends String> extends SimpleComboBox<T> { public MySimpleComboBox() { super(); this.addKeyListener(new KeyListener(){ @Override public void componentKeyDown(ComponentEvent event) {
And the test:
package net.binarymuse.gwt.gxt.client; import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; public class GxtSandbox implements EntryPoint { public void onModuleLoad() { SimpleComboBox<String> box = new MySimpleComboBox<String>(); box.add("One"); box.add("Two"); box.add("Three"); box.setEditable(false); box.setForceSelection(true); RootPanel.get().add(box); } }
Giving focus to the list and pressing "T" should select "Two" in the list.
As with the case, the class always selects the first item in the list, which begins with a character; however, it is not difficult to change it so that it selects the next element in the list (as is typical for "real" combined fields).
source share