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 ?


Recommended Answers

All 4 Replies

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.

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() {

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.