orange451/LWJGUI

TextField consumes up and down arrow key presses

Closed this issue · 3 comments

I have a TextField control that is used as a "console", I'd like to traverse command history when user presses up/down arrow/cursor -keys. However, the events are consumed by the TextField control and never reach my event handler.

This works with JavaFX 14, my current implementation (using JavaFX): https://github.com/Peanhua/plortz/blob/master/src/main/java/plortz/ui/javafx/Console.java

For example, the following code will not print anything when user presses up/down arrow keys when the text field is active:

var tf = new TextField();
tf.setOnKeyPressed((event) -> System.out.println("pressed " + event.getKeyName()));

Will take a look into this!

Alright, I pushed a small change that makes TextInput not consume arrow key presses. Let me know if this is the intended functionality for you.

Thanks, works perfectly :)