Hi all,

I am using a SWT combo box in java. The functionality is like whenever a user enter string in the combos text field, based on that string i am filtering the combos list values and displaying the list using combo.setListVisible(true).

Now, after typing the first letter the list gets displayed and the combos text field is losing focus. So inorder to continuously enter the text the user needs to click in the text field after typing each letter. Is there any fix so that the user can continuously enter the text and the list gets displayed after each new letter typed ?


5 Years
Discussion Span
Last Post by Aviras

A simple requestFocus would probably do the trick, but there might be a more elegant solution. But for that I'd have to actually see some of your code.

Edited by Aviras: n/a


Hi Aviras,

Following is the code i am using. Whwnever i type a letter in combos textfield, on the keyreleased event i am calling a function that will prepare the list values and the list will drop down because of comboLabel.setListVisible(true);.

Now the focus is out of combo's textfield. Is there a way to get the focus back to textfield with out affecting the displayed list ?

comboLabel.addKeyListener(new KeyListener() {
public void keyReleased(KeyEvent e) {
/*I am calling a function here that will prepare the list values for combo box*/
Display.getCurrent().asyncExec(new Runnable() {
public void run() {

Edited by Nick Evan: Fixed formatting


Also requestFocus is in awt, is there any such method for SWT ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.