I am working with suggestion box in gwt and added SelectionHandler and onFocusHandler to the suggestion box but after selection the suggestion list remains visible.. Which should not be the case.
What should I do to hide the suggestion list after selecting one of the suggestion.?
suggestBox.getValueBox().addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
if(suggestBox.getText().equals("")){
suggestBox.setText(" ");
suggestBox.showSuggestionList();
suggestBox.setText("");
}
}
});
suggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
@Override
public void onSelection(SelectionEvent<Suggestion> arg0) {
if (arg0.getSelectedItem() instanceof Suggestion) {
//code to take actions after selection
}
}
});
Why don't you hide the list in your selection handler?