I am trying to create an on-screen keyboard for a touch-screen kiosk. Does anyone know how to send a keyboard event to a text input component from a button click event? For example, the user will push the on-screen buttons to enter their name, press tab to go to the next field, and so on.
I believe that I somehow need to use dispatchEvent but have not been able to get it to work. For example, pressing the on-screen A keyboard button will fire a CLICK event and call a handler to place an A in the currently focused text input component. The handler needs to be able to dispatch a keyboard event (with the correct keycode) to that text input field and that is where I am stuck.
Is this possible or am I on the wrong track?
Thank you in advance for any help or ideas.
You cannot force mouse or keyboard events - they HAVE TO come from mouse or keyboard.
In your case, since touch screen invokes MouseEvent - you, perhaps need to write your own code that will fire events from keyboard UI (not keyboard itself) and detect what "key" was clicked. It is similar to regular button functionality.
Are you positive that it is impossible to emulate a keyboard press?
'Cause I'm facing a quite difficult situation. I must read the mouse movement in X. Depending if X is positive or negative, it should dispatch and event saying that the left or right arrow have been pressed. Ain't there no other way to fake a key press?
Europe, Middle East and Africa