B4J Question [Solved] Keyboard events

jmon

Well-Known Member
Licensed User
Longtime User
Hello,

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.

Thanks

[EDIT] Solution in post #6
 
Last edited:

jmon

Well-Known Member
Licensed User
Longtime User
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
Hi,

I found a solution using the jRELECTION library (you will need to install it to use the following example : http://www.b4x.com/android/forum/threads/jreflection-library.35448/#content), and it works as I needed it. I can now get SHIFT+ENTER or ENTER event in the TextArea control! ;-)

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?

Regards,
Jmon
 

Attachments

  • KeyboardEvent.zip
    2.5 KB · Views: 788
Upvote 0
Top