Questions tagged [key-events]

An event that is triggered when a Key is pressed on a keyboard input device

A KeyEvent is an event that is triggered when a Key is pressed on a keyboard input device. The event will contain information relating to the particular key that was pressed, how long the key was pressed for, and whether any modifier keys were also pressed (such as Ctrl or Alt).

204 questions
5
votes
2 answers

KeyPress\Up\Down doesn't work - C#

I have this code: private void Form1_KeyDown(object sender, KeyEventArgs e) { MessageBox.Show("Fail!"); } And I've set the event in the Form - but it simply isn't activated. Other events like Resize or MouseDown work well, only this doesn't…
Mark Segal
  • 5,427
  • 4
  • 31
  • 69
5
votes
2 answers

Android - Why does onKeyUp trigger a KeyEvent, but onKeyDown does not?

In my current View, a keyboard is open with numbers 0 to 9, a delete key and an enter key. I added both an onKeyDown and an onKeyUp event. Both should log the keycode to the debug console when pressed. @Override public boolean onKeyDown(int…
keinabel
  • 1,002
  • 3
  • 15
  • 33
5
votes
1 answer

How to send KeyEvents through an input method service to a Dialog, or a Spinner menu?

I'm trying to implement an input method service that receives intents sent by a remote client, and in response to those sends an appropriate KeyEvent. I'm using in the input method service this method private void keyDownUp(int keyEventCode) { …
5
votes
3 answers

Qt sending keyPressEvent

I want to append chars to QLineEdit by sending KeyEvent. I'm using code like this: ui.myEdit->setFocus(); for(size_t i = 0; i < 10; ++i) { QKeyEvent keyPressed(QKeyEvent::KeyPress, 'a', Qt::NoModifier); QWidget::keyPressEvent(&keyPressed); //…
user3369485
  • 117
  • 1
  • 1
  • 7
5
votes
1 answer

Problems detecting SHIFT keys in Java on Windows

I'm writing a simulation of an old machine in Java and I'd like my keyboard handling to treat the left- and right-SHIFT keys independently. I have a standard AWT KeyListener registered and process the KeyPressed() and KeyReleased() methods. …
tjb300
  • 105
  • 5
5
votes
2 answers

Keyevent to click on Alert Dialog of Android screen

Is there any way to simulate keyevent on "OK" or "CANCEL" buttons of Android dialogue box using adb commands?
Fresher
  • 269
  • 5
  • 16
5
votes
4 answers

BlackBerry - KeyListener with global scope

I am new to BlackBerry App development. I want to be able to listen for keypress events whenever the BlackBerry (8900 in my case) is on and on all screens is this possible? If so, it would be great for someone to direct me in the right direction. I…
Abs
  • 56,052
  • 101
  • 275
  • 409
5
votes
3 answers

How to make a moving div restricted in an outside div?

So I have a div you move with your arrow keys, but how do I make it so it can't go outside the "border div"? $(document).ready(function(){ $(document).keydown(function(e) { switch (e.which) { case 37: // Left …
4
votes
4 answers

Need to 'extend' both MouseAdapter and KeyAdapter

Just wondering what is the best practice way of creating a class that needs to handle mouse clicks and key presses. Obviously it is not possible to inherit multiple classes in Java so at the moment I am using the MouseListener and KeyListener…
Jim_CS
  • 4,082
  • 13
  • 44
  • 80
4
votes
2 answers

accelerator key value java.awt.event.KeyEvent

I'm using accelerator to perform CTRL+C then CTRL+V using java/junit is there a way to get the value of CTRL+V to check it ?
lola
  • 5,649
  • 11
  • 49
  • 61
4
votes
2 answers

ENTER key using in JTextField java

I'm using two JTextField in Java Swing form. Now I enter the values in JTextField1. Next if I press ENTER KEY means the cursor move to JTextField2. How to do this?
java872
  • 89
  • 1
  • 3
  • 5
4
votes
1 answer

Javascript - simulate key events on Chrome 53

I am trying to simulate key event (press) on Chrome 53. All the solutions that I found on StackOverflow seems not to be working.. My goal is to have a function that gets a keyCode and simulates a key press with it - Pure JS is required function…
Oz Bar-Shalom
  • 1,747
  • 1
  • 18
  • 33
4
votes
1 answer

Python: How to activate an event by keypress with pyautogui?

I've installed the pyautogui package to use the .hotkey() function to trigger an event. For example: If you press the key combination "Ctrl + c" the console shall display the message "Hello world". I tried something like this: while True: if…
Ramón Wilhelm
  • 967
  • 2
  • 18
  • 39
4
votes
2 answers

Always in upper case... (C# winforms)

I have a TextBox in my form and I added this event on it: private void txtValue_KeyDown(object sender, KeyEventArgs e) { MessageBox.Show(e.KeyData.ToString()); } But it always prints the upper case of the letter even…
yonan2236
  • 13,371
  • 33
  • 95
  • 141
4
votes
2 answers

Capturing OS X media key events in Firefox

Does Firefox provide an API for extensions to capture media key events on OS X? These are physically located on the F7/F8/F9 keys on Apple's keyboards, but they don't have keycodes, so it seems impossible to intercept a media key press event with an…
Jules
  • 14,200
  • 13
  • 56
  • 101
1
2
3
13 14