我正在使用 gwt 中的建议框,并将 SelectionHandler 和 onFocusHandler 添加到建议框中,但选择后建议列表仍然可见。这不应该是这种情况。
选择其中一项建议后,我应该怎么做才能隐藏建议列表。?
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
}
}
});