B4J Question program keyboard direction

boten

Active Member
Licensed User
Longtime User
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.
 
Upvote 0
My bad... I meant alt+shift
Code: Copy
RobotSpecialKeyPress("alt")
RobotSpecialKeyPress("shift")
did it. Thx
 
Last edited:
Upvote 0
Don't forget to release those keys after pressing them. You'll probably also want a brief (maybe 10 millisecond) delay between pressing and releasing.
 
Upvote 0
You can easily implement a short delay with CallSubPlus: CallSubPlus - CallSub with explicit delay
No need for any delay. alt+shift switches to Hebrew immediately
Code: Copy
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
 
Upvote 0
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).
 
Upvote 0
Back
Top