Skip to content

Focus gets lost #12

Description

@thomaspp

Hello!

Great addon and very useful.
Unfortunately the focus gets lost after pressing the "x".

Therefore for example my shortcust listener is not longer called:


public final class TextFieldUtils {

@SuppressWarnings("serial")
public static void handleEnterEvent(TextField searchField, Listener listener) {
    ShortcutListener enterShortCut = new ShortcutListener("EnterShortcut", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            listener.handleAction(sender, target);
        }
    };
    handleShortcut(searchField, enterShortCut);
}

private static void handleShortcut(AbstractTextField textField, ShortcutListener shortcutListener) {
    textField.addFocusListener((FieldEvents.FocusEvent event) -> textField.addShortcutListener(shortcutListener));
    textField.addBlurListener((FieldEvents.BlurEvent event) -> textField.removeShortcutListener(shortcutListener));
}

}

Best Regards,
Thomas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions