controlsfx / controlsfx

High quality UI controls to complement the core JavaFX distribution
https://controlsfx.org
BSD 3-Clause "New" or "Revised" License
1.57k stars 269 forks source link

add mnemonic and keyboard support for CheckComboBox #1085

Open JonathanGiles opened 5 years ago

JonathanGiles commented 5 years ago

Original report by Hollis Waite (Bitbucket: hwaite, GitHub: hwaite).


CheckComboBox doesn't accept focus when user attempts Alt- shortcut. Also, it should be possible to expand associated listbox via keyboard.

#!java

public class Test extends Application {
    @Override public void start(Stage pStage) {
        final GridPane gridPane = new GridPane();

        final ObservableList<String> items =
         FXCollections.observableArrayList("alpha", "bravo", "charlie");

        (
            new LinkedHashMap<String,Node>() {
                {
                    put("_ComboBox",new ComboBox<>(items));
                    put("_TextField", new TextField());
                    put("_Spinner", new Spinner<>(0, 10, 0));
                    put("Chec_kCombo", new CheckComboBox<>(items));
                }
            }
        ).forEach(
            (pText, pNode) -> {
                final Label label = new Label(pText);
                label.setLabelFor(pNode);
                label.setMnemonicParsing(true);
                final int row = gridPane.getChildren().size() / 2;
                gridPane.add(label, 0, row);
                gridPane.add(pNode, 1, row);
            }
        );
        pStage.setScene(new Scene(gridPane));
        pStage.show();
    }

    public static void main(String[] pArgs) {launch(pArgs);}
}
JonathanGiles commented 5 years ago

Original comment by Hollis Waite (Bitbucket: hwaite, GitHub: hwaite).


There are probably similar problems with other controls. Would be nice if they were all operable via keyboard.