Questions tagged [keydown]

"keydown" is an event used in writing software that is triggered when a key on the keyboard is being pressed. It usually precedes the event "keyup".

1434 questions
12
votes
4 answers

Detect Enter Key C#

I have the following code which does not show the MessageBox when enter/return is pressed. For any other key(i.e. letters/numbers) the MessageBox shows False. private void cbServer_TextChanged(object sender, EventArgs e) { if (enterPressed) …
k1f1
  • 433
  • 3
  • 8
  • 16
12
votes
5 answers

Is it possible to override the keydown repeat delay, in JavaScript?

The objective is manually set a held key's "repeat rate". For example, when in a text box and pressing and holding the X key, I understand that there is browser-specific ways of repeating the pressed character. In some, it pauses, then continuously…
jeffjenx
  • 17,041
  • 6
  • 57
  • 99
11
votes
3 answers

Get keyDown event for an NSTextField

In xcode last version, I am trying to get the keyDown event of an NSTextField. However, despite following multiple tutorials on the internet (delegates, controllers...), I still can't receive it. Any easy hint for me ? Thanks !
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
11
votes
4 answers

How to filter keydowns with rxjs?

I need to get clean keydown/keyup events without repetitions. When you press a key keydown event happens, when you release - keyup. Without messy repeated keydowns. Here's code: var keyDowns = rx.Observable.fromEvent(document, 'keydown'); var keyUps…
yevt
  • 732
  • 1
  • 6
  • 21
11
votes
3 answers

Swift OSX key event

I have been working on a Cocoa OSX project in swift that requires the use of keyboard input to preform an action. On keydown i want to move an object across the window, but stop the object as soon as the key is let up. I have looked in the…
user4064541
11
votes
1 answer

Control key plus mouse wheel

What's the better way to handle the ctrl + mouse wheel in C#? I've figured out how to handle the MouseWheel event but how to know that the ctrl key is being pressed too?
Adones Cunha
  • 373
  • 1
  • 6
  • 14
10
votes
2 answers

Detect Arrow Key - KeyDown for the whole window

I have a WinForms Form (C#/.Net) and it contains a PictureBox, MenuStrip, Panel and two Button controls. I need to detect KeyDown event for the Arrow Keys for the whole window; i.e., when the window is in the foreground, regardless of which one of…
user529141
10
votes
4 answers

KeyDown event not Working on PrintScreen Key

I am using C# windows Application I am checking which key, user have pressed down by keyboard. I have checked for all keys but its not working in case of printScreen private void comboBox1_KeyDown(object sender, KeyEventArgs e) { …
Javed Akram
  • 15,024
  • 26
  • 81
  • 118
10
votes
1 answer

jQuery: How to catch keydown + mouse click event?

I have a div element. I need to catch a mouse click on this div while alt-key (keyCode = 17) is pressed. Here is what i've got to catch key press: // Html
I want to put a ding in the universe.
//…
foreline
  • 3,751
  • 8
  • 38
  • 45
10
votes
8 answers

KeyDown event - how to easily know if the key pressed is numeric?

I am currently handling the KeyDown event of a DataGridView control. One of the columns is filled by calculated values and I want the user to be able to override the cell value if they want. When the user presses a numeric key, the cell goes into…
Kharlos Dominguez
  • 2,207
  • 8
  • 31
  • 43
10
votes
1 answer

Detect CTRL and SHIFT key without keydown event?

I've been wondering if I can detect CTRL and SHIFT key being pressed WITHOUT using keydown event. The reason is that I am creating some sort of Grid Viewer in JavaScript, and I implemented selecting different items by holding CTRL or SHIFT key as it…
Flash
  • 466
  • 6
  • 16
9
votes
4 answers

javascript (jquery) numeric input: keyCode for '3' and '#' are the same

I need to set up an so that it will accept only numeric chars, backspace, delete, enter, tabs and arrows. There's a lot of exemple around there, i started with something similar to this: function isNumericKeyCode (keyCode){ …
Johnny5
  • 6,664
  • 3
  • 45
  • 78
9
votes
1 answer

How can I get keydown events on a div in chrome?

I'd like to get keydown events on a div. I use JQuery keydown. Pretty simple. However, it does not work on chrome. For this to work on chrome, I have to set tabindex = 0. If I do this, Chrome puts an ugly orange border around my div. Is there a way…
user380719
  • 9,663
  • 15
  • 54
  • 89
9
votes
12 answers

How do I convert a "Keys" enum value to an "int" character in C#?

This seems like something that should be easy, but I am having a tough time figuring out what needs to happen here. In the "KeyDown" eventhandler, if the "e.KeyValue" is a number, I want to treat it as a number and store it as an int. So, if I hit…
Andy Stampor
  • 688
  • 2
  • 9
  • 24
9
votes
0 answers

keypress being deprecated, how to get the characters typed by a user?

The javascript keypress event is deprecated: https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event Some people advise to rely exclusively on the keydown event, eg.: Keydown is the only keyboard event we…
augustin
  • 14,373
  • 13
  • 66
  • 79