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
9
votes
1 answer

How does Java dispatch KeyEvents?

I've read the definite tutorial on key bindings a few times, but my brain cache doesn't seem large enough to hold the complicated processes. I was debugging a key binding problem (turned out I was using the wrong JComponent.WHEN_* condition), and I…
Geoffrey Zheng
  • 6,562
  • 2
  • 38
  • 47
9
votes
3 answers

How to check KeyboardEvent.key in specific range in Javascript

In Javascript, I have callback function for keydown event. I use keyCode and which properties to detect which keys user pressed. var keyPressed = event.keyCode || event.which; if (keyPressed > 47 && keyPressed < 58) { //do something } It…
Le Thanh
  • 227
  • 4
  • 10
9
votes
2 answers

Android - Capture "Done" and "Enter" key events on soft keyboard

I have a Login page in my app where there are elements as listed: username (EditText) password (EditText) Login (Button) On pressing Login, it will land into the main screen. The intention is to perform that same action when the user hits Done…
9
votes
1 answer

When should I use keydown and keyup?

Which event should be used for key press handling key-down/key-up? It is sure that in both case the program will run successfully. But which one will be more user-friendly?
Nafeez Abrar
  • 1,045
  • 10
  • 27
8
votes
1 answer

Send a key combination (meta key and keycode) via the Android API

I can't figure out how to send a combination of a meta key (e.g. CTRL) and a keycode (e.g. for RETURN) with Android (I am using API level 11 = version 3.0). The documentation of the class KeyEvent mentions constants like META_CTRL_ON and also…
Florian Wolters
  • 3,820
  • 5
  • 35
  • 55
8
votes
2 answers

How to detect META key press during Drag and Drop on OSX

There is a bug in Java 6/7 on OSX where during Drag and Drop operations, it ignores the META (CMD) key. (Ctrl key works just fine on Windows, Ctrl key is also ignores on OSX) I REALLY need to have this working. See: Java Drag and drop on OS X…
CasaDelGato
  • 1,263
  • 1
  • 12
  • 29
8
votes
2 answers

How to get keyCodes from Android mobile device keyboard?

Currently, I am facing a problem on a mobile device. I have an input field where only some keys are allowed to be pressed: e.g. only the numbers 0–9. It works fantastic on a web browser. But when I open it in my Android mobile device it fails. I…
Arya
  • 395
  • 2
  • 6
  • 14
8
votes
1 answer

Android: Key Event from Android Box remote controller

I was interested to know how can i catch key/button events from Android TV Box remote controller? For example, i want a popup menu to show when i click the OK button from remote controller. And i want to catch the next/back key events from remote…
strategos
  • 119
  • 1
  • 2
  • 6
8
votes
5 answers

onKeyEvent & Accessibility Service

My users will be using TalkBack enabled or some other Accessible Service. I would like to capture the onKeyEvent events in our App but the event is dispatched to the enabled Accessibility Services. I have created the following basic Accessibility…
8
votes
3 answers

Cannot listen to KeyEvent in JavaFX

I want my JavaFX program to respond to keyboard events. I tried adding listeners to root Pane, to topmost Pane, but it doesn't respond to events! Here is my code: AnchorPane root = new AnchorPane(); root.setOnKeyPressed(new…
Chechulin
  • 2,426
  • 7
  • 28
  • 35
8
votes
5 answers

Java converting keycode to string or char

I want to turn keyevent keycode value into a string or a char value. Either one would do. For example, when I press 'SPACE', which 'lets say' has a keycode 20, and I want to convert that value to a char or a string. Is there any standard way of…
user2098268
  • 121
  • 2
  • 2
  • 7
8
votes
4 answers

Capture backspace key press in BlackBerry with jQueryMobile

Is there a way to capture backspace key press on a input[type="text"] in BlackBerry? I have tried with $('input[type="text"]').bind('keydown', function(event) { ... }); and it captures all key press events except the one for the backspace (del).…
7
votes
4 answers

Android: Is there a way to simulating D-Pad Events (API 10)?

The problem is very simple. I have to simulate the dpad events (UP,DOWN,RIGHT,LEFT,CENTER) for navigate in my GUI that consists of a lot of buttons and other elements. With the simulator D-Pad I can without a line code navigate throw this GUI. But…
NitroBoarder
  • 93
  • 1
  • 5
7
votes
5 answers

Fire Form KeyPress event

I have a C# winform, on which I have 1 button. Now, when I run my application, the button gets focus automatically. The problem is KeyPress event of my form does not work because the button is focused. I have tried this.Focus(); on FormLoad()…
Javed Akram
  • 15,024
  • 26
  • 81
  • 118
7
votes
2 answers

C# Consume Global Key Event

I'm facing a tough one right now, at least it's tough for me! I'm using this code to capture key press events and it works just fine even when the window is out of focus. In addition though, I'd like to be able to consume the key event before it is…
Maverick283
  • 1,284
  • 3
  • 16
  • 33
1 2
3
83 84