Questions tagged [keyevent]

An event that is triggered when a key is pressed,released or remains pressed on a keyboard input device.

A KeyEvent is an event that is triggered when a key is pressed, released or remains pressed on a keyboard input device. The event can contain:

  • info about particular key that was pressed/released
  • how long the key was pressed
  • whether any modifier keys were also pressed (such as Ctrl or Alt).
  • type of event - press, release, other (for example character was typed, regardless whether key was pressed or released)

Some platforms/keyboards may generate auto-repeat key events - same character is typed repeatedly while key remain pressed

1258 questions
7
votes
2 answers

How to search with enter key on android custom InputMethodService?

I want to search with my android custom keyboard with the enter key, but it does not work. I've already mapped the keys, I just need to trigger the "search action" on a search text field, just like searching on google. I tried this code for…
7
votes
2 answers

JavaFX TextField : Automatically transform text to uppercase

I have a JavaFX TextField control on my FXMl that looks like this... I want to automatically change all characters to uppercase when the user is…
Martin
  • 474
  • 2
  • 6
  • 17
7
votes
2 answers

Simulating combination of key presses from ADB terminal

I want to send "CTRL + W" to the Chrome for Android to close active tab. I tried lots of things but there is no success to achieve it from terminal. (If i connect a USB Keyboard with OTG, i can close the tab with CTRL+W) Firstly i do not want to…
Yusuf
  • 87
  • 1
  • 5
7
votes
1 answer

How to get the last key pressed in python?

First I want to say that I know that there is a solution with curses. My programm is a while loop that is run every second. Every second I want to get the last key that was or is pressed. So in case you press a key while the loop sleeps I want that…
timakro
  • 1,739
  • 1
  • 15
  • 31
7
votes
2 answers

dispatchKeyEvent from Service

I have a floating view created in service, and I need to dispatch key events when I touch this view. I have found out that view.dispatchKeyEvent() needs context of foreground activity, and key event dispatching only works when activity is…
7
votes
1 answer

JavaFX KeyEvent returns KeyCode.UNDEFINED

I created a simple JavaFX application that receives input from the user in a TextField. I attached the KeyTyped event from SceneBuilder to the controller. My function looks like this: @FXML private void keyTyped(KeyEvent event) { …
j will
  • 3,747
  • 11
  • 41
  • 64
7
votes
1 answer

Use keyPressEvent to catch enter or return

I have a simple form with some combos, labels, buttons and a QTextEdit. I try to catch the enter or return key with keyPressEvent, but for some reason I'm not able to. The ESC key however, that I also use, is recognized. Here's a piece of the code: …
zappfinger
  • 497
  • 2
  • 5
  • 15
7
votes
1 answer

EditText not receiving TAB key events - stock soft vk

My app has a ListView and an EditText sitting below it. For some reason, the TAB key doesn't trigger the onKeyListener. All other keys I'm handling (DEL, ENTER, DPAD_UP/DOWN/CENTER) are received just fine. I added a breakpoint in dispatchKeyEvent,…
Al.
  • 2,285
  • 2
  • 22
  • 30
6
votes
3 answers

KeyEvent characters

I have a question about a KeyListener. When I get the KeyEvent and do a getKeyChar() I'm tyring to compare to and * asterisk and I was going to use one of the KeyEvent.VK_ defines which works for a lot of the keys. But for this particular key and…
user565660
  • 1,171
  • 3
  • 20
  • 37
6
votes
5 answers

What is the java keyevent field for dot '.'?

I know how to call 1 using keyevent which should be like aaa.keyPress(KeyEvent.VK_1); Now I need to type (.) dot? But I could not find (KeyEvent.VK_DOT) or some similar command. Please help Thanks
Marco
  • 985
  • 7
  • 22
  • 50
6
votes
1 answer

Android KeyEvent.getCharacters() or keyEvent.characters is deprecated

As per documentation from API 29, KeyEvent.getCharacters() is deprecated, but there is no alternative that I could find for same. As per documentation it says "@deprecated no longer used by the input system." from API 29. What does this actually…
Ali Ashraf
  • 1,841
  • 2
  • 24
  • 27
6
votes
3 answers

Fake KeyEvent doesn't work *exactly* like "real" button. Why?

I am trying to invoke my main activity's onKeyDown() with KEYCODE_BACK, so that it behaves as if I pressed the 'back' button myself. I do that using the following code: KeyEvent goBackDown = new…
srf
  • 2,410
  • 4
  • 28
  • 41
6
votes
6 answers

Disable SPACE key in EditText android

I'd created EditText with following.
Saunik Singh
  • 996
  • 1
  • 9
  • 19
6
votes
2 answers

javascript dispatchEvent Keypress, returns true , but input field is still empty

I need to trigger or say dispatchEvent KeyPress inside an Input box, I have tried a lot with "initKeyboardEvent" , "initKeyEvent" , "createEvent", even I found similar question's answers but nothing seems to work, neither in firefox, nor in chrome…
Priyanka
  • 806
  • 1
  • 9
  • 21
6
votes
5 answers

Responding to key events in scala

I'm experimenting with a bit of Scala gui programming (my first project in scala, so I thought I'd start with something simple). But I seem to have got stuck at something that seems like it should be relatively trivial. I have a class that extends…
Ceilingfish
  • 5,397
  • 4
  • 44
  • 71