I can't figure out how to respond to keyboard events in B4J, a bit like keypressed in B4A. I want my application to respond to {ENTER} or {SHIFT + ENTER} strokes.
The problem with keyboard events is that most nodes intercept the events and will not let you handle them.
Currently the keyboard events are not exposed. However even when they will be exposed you will still not be able to catch these events unless the form is empty.
You can handle the enter button if you use TextField (single line text box). You can then handle the Action event which is raised when the user presses on the enter button.
So in this example I use a class to create my controls, and in each class instance, I add event handlers that will be local to this class instance. Also the example shows how to do key combination like {SHIFT+ENTER}. It's quite easy to implement.
I just have a question regarding this example. I get a "java.lang.NullPointerException / at com.sun.javafx.scene.control.skin.TextAreaSkin.scrollBoundsToVisible(TextAreaSkin.java:998)" error when I scroll the mouse in the TextArea control. Anyone knows why?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.