Hi guys,
I have a text field where I want to add ENTER key shortcut listener
I can add it like this:
ShortcutListener shortcut = new ShortcutListener("Shortcut Name", ShortcutAction.KeyCode.ENTER, null) {
@Override
public void handleAction(Object sender, Object target) {
log.info("Enter pressed: INDUSTRY STANDARD");
}
};
searchInput.addFocusListener(new FocusListener() {
public void focus(FocusEvent event) {
someButton.addShortcutListener(shortcut);
log.info("Enter pressed according to INDUSTRY STANDARD");
}
});
However my entire app is attached to the someButton
searchBtn.addClickListener((Button.ClickListener) event -> {
log.info("My applicatin where clicking on the button executes the search app");
});
Now how do I make so that both pressing ENTER key
and the button (someButton) executes my search app…
Any ideas