PDA

View Full Version : ComboBox blur problem!!



eugenparaschiv
10 Oct 2008, 5:46 AM
I have a problem with ComboBox behavior. I just want to lose focus on the combo box after I select something, so I send an ONBLUR event (I will provide the code). The event does blur the combo box, but it seem the cursor is still positioned inside it and is still blinkind. For instace, if I start writing, it writes inside the combo box. This is obviously not good, because the box was supposed to be out of focus at this point. Is this a bug or should I do something else to unfocus the currsor in some way? This is the test case for the bug:



public class Test implements EntryPoint {

public void onModuleLoad() {
final Viewport view = new Viewport();
final ContentPanel panel = new ContentPanel();
panel.setSize(300, 300);

final SimpleComboBox<String> combo = new SimpleComboBox<String>();
final String[] array = { "Value1", "Value2", "Value3" };
final List<String> values = Arrays.asList(array);
combo.add(values);

//config
combo.setWidth( 150 );
combo.addListener( Events.Collapse, new Listener<FieldEvent>(){
public void handleEvent( final FieldEvent fEv ){
DeferredCommand.addCommand( new Command(){ //so that the Collapse event can complete before this
public void execute() {
fEv.type = Event.ONBLUR;
combo.onComponentEvent( fEv );
}
});

}
});

panel.add( combo );
view.add( panel );
RootPanel.get().add( view );
}

}

gslender
10 Oct 2008, 5:00 PM
try setting the next field focus() instead

cheers,
grant