Is there a way to programatically change the keyboard direction, thus simulating alt+tab? I have some text fields that need input in Hebrew and i want to change the kb language in code when the field gets focus. It was possible in VB.
The jAWTRobot library will allow you to programmatically invoke system key-pressed and mouse-pressed events. If your desired effect can be effected by a key-combo, then it can be effected in code by this library.
No need for any delay. alt+shift switches to Hebrew immediately
B4X:
Sub txtShem_FocusChanged (HasFocus As Boolean)
Dim wr As AWTRobot
wr.RobotSpecialKeyPress("alt")
wr.RobotSpecialKeyPress("shift")
wr.RobotSpecialKeyRelease("alt")
wr.RobotSpecialKeyRelease("shift")
End Sub
works just fine.
Switches to Hebrew when field got focus, switches back to English when lost focus
You might find that this code won't work on other systems as some systems require a key or mouse button to be held down longer than a minimum required time in order to be registered. If you run into this issue, you can use ws.RobotDelay(10).