MaterialFX icon indicating copy to clipboard operation
MaterialFX copied to clipboard

Make UP and DOWN arrows select another index in MFXFilterComboBox

Open FelipeAumannRS opened this issue 8 months ago • 1 comments

Tried using the code blow to move selected index in MFXFilterComboBox popUp, didn't work. As far as I can tell, there's no way of retrieving popUp to change its behavior.

Platform.runLater(() -> {
                BoundTextField textFieldNode = (BoundTextField) comboBox.lookup(".text-field");

                if (textFieldNode != null) {
                    textFieldNode.setOnKeyPressed( ev -> {
                        if (ev.getCode() == KeyCode.DOWN || ev.getCode() == KeyCode.KP_DOWN) {
                            comboBox.selectNext();
                            ev.consume();
                        } else if (ev.getCode() == KeyCode.UP || ev.getCode() == KeyCode.KP_UP) {
                            comboBox.selectPrevious();
                            ev.consume();
                        }
                    });
                }
            });

FelipeAumannRS avatar Jun 04 '25 03:06 FelipeAumannRS

Hello, unfortunately to change the behavior I think you'll have to tinker with the combo's skin, where the popup is created.

I'll mark this as an enhancement for the new version

palexdev avatar Jun 04 '25 07:06 palexdev