PDA

View Full Version : combobox focus



diegolovison
4 Jan 2011, 3:21 AM
final ComboBox<BeanModel> combo1 = new ComboBox<BeanModel>();
combo1.setStore(store1);
combo1.setDisplayField("name");
combo1.setAllowBlank(false);

final ComboBox<BeanModel> combo2 = new ComboBox<BeanModel>();
combo2.setStore(store2);
combo2.setDisplayField("name");
combo2.setAllowBlank(false);
combo2(Events.Select, new Listener<BaseEvent>() {
@Override
public void handleEvent(final BaseEvent be) {

if (combo1.isValid() && combo2.isValid()) {

// add values on grid

combo1.setValue(null);
combo2.setValue(null);

combo1.clearInvalid();
combo2.clearInvalid();

combo1.focus();
}
}
});


the focus work fine...
but the second combo continue selected (see the trigger button, is blue).. and if the user click out.. will valid the two combobox...

how I can solve this?

thanks

sven
4 Jan 2011, 11:25 AM
You need to call triggerBlur (protected at the moment) on the combobox manully. We plan to fix this on some future version.

diegolovison
4 Jan 2011, 12:24 PM
sorry... but I dont understant how I can solve the problem...

I try


public MyComboBox extends ComboBox {
@Override
public void focus() {
triggerBlur(null);
super.focus();
}
}

dont work....

sven
4 Jan 2011, 12:28 PM
You need to call triggerBlur on the other ComboBox you want to blur :)

diegolovison
4 Jan 2011, 12:33 PM
XComboBox


public void triggerBlur() {
super.triggerBlur(null);
}




combo2(Events.Select, new Listener<BaseEvent>() {
@Override
public void handleEvent(final BaseEvent be) {

if (combo1.isValid() && combo2.isValid()) {

// add values on grid

combo1.setValue(null);
combo2.setValue(null);

combo1.clearInvalid();
combo2.clearInvalid();

combo2.triggerBlur();
combo1.focus();
}
}
});


so?