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
18
votes
7 answers

WPF Key is digit or number

I have previewKeyDown method in my window, and I'd like to know that pressed key is only A-Z letter or 1-0 number (without anyF1..12, enter, ctrl, alt etc - just letter or number). I've tried Char.IsLetter, but i need to give the char, so…
user13657
  • 745
  • 3
  • 17
  • 36
16
votes
4 answers

Select next NSTextField with Tab key in Swift

Is there a way to change the responder or select another textfield by pressing tab on the keyboard, in Swift? Notes: It's for a fill in the blank type application. My VC creates a list of Words [Word], and each of those words has its own WordView -…
Aaron
  • 1,312
  • 3
  • 14
  • 25
15
votes
3 answers

pygame keydown combinations (ctrl + key or shift + key)

I have some python code with keydown events happening, I am basically wondering if it is possible to have two keys pressed at a time, like ctrl+a or something like that. Is this possible, or will I have to find a workaround?
ZenLogic
  • 317
  • 1
  • 4
  • 21
15
votes
6 answers

keydown event new value

Browser: Google Chrome V19.0.1084.52 I have a textbox which needs to be a number less than or equal to 255, on keydown I want to check if this value is above or equal to 255 else prevent the event. In the Console when I console.log the event it will…
William Isted
  • 11,641
  • 4
  • 30
  • 45
14
votes
3 answers

Use EventTrigger on a specific key

I would like to invoke a command using EventTrigger when a particular key is touched (for example, the spacebar key) Currently I have:
lost_bits1110
  • 2,380
  • 6
  • 33
  • 44
14
votes
10 answers

Using jQuery, why is this function being called when I only click one of the two keys?

I have this code: $(document).bind('keydown', 'ctrl+1', function () { alert('You found the hotkey ctrl+1!'); }); But if I click on either the Ctrl or the 1 key, this code seems to fire. I only want this code to fire when both keys are…
leora
  • 188,729
  • 360
  • 878
  • 1,366
13
votes
1 answer

Javascript 'keydown' event listener is not working

The mousemove event works and calls onMouseMove each time I move on the canvas. Although, the keydown and keyup events never work. I click on the canvas and hit some keys, but no event is triggered. Does anyone know why the events are not…
user1668814
  • 431
  • 2
  • 6
  • 13
13
votes
4 answers

How to disable repetitive keydown in JavaScript

I have a same problem like this guy How to disable repetitive keydown in jQuery , it's just that I'm not using jQuery so I'm having hard time translating it to "pure" JavaScript, anyways I have set switch-case of some keys and when I press and hold…
Novak
  • 145
  • 1
  • 1
  • 5
13
votes
2 answers

keydown + keyup events for specific keys

I'm trying to make the background color change when certain keys are held down. For example, when the 'r' key is being held down, the background should be red. When the 'r' key is not being pressed anymore, the background should default to…
user1115666
13
votes
7 answers

How do you detect simultaneous keypresses such as "Ctrl + T" in VB.NET?

I am trying to detect the keys "Control" and "t" being pressed simultaneously in VB.NET. The code I have so far is as follows: Private Sub frmTimingP2P_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If…
J2Tuner
  • 411
  • 1
  • 5
  • 17
13
votes
2 answers

vb.net Keydown event on whole form

I have a form with several controls. I want to run a specific sub on keydown event regardless any controls event. I mean if user press Ctrl+S anywhere on form it execute a subroutine.
Malik
  • 217
  • 2
  • 5
  • 13
12
votes
2 answers

How to disable repetitive keydown in jQuery

When user keeps a key pressed, I want the keydown() event get called only once, but its called until user stops pressing the key. Here is what I am trying to do: $(document).keydown(function(event){ var keycode = (event.keyCode ?…
Nazar
  • 1,385
  • 4
  • 15
  • 18
12
votes
2 answers

How can I use a 'keydown' event listener on a div?

I am trying to capture keydown events where specific keys correspond to specific audio clips to be played. I've been searching but I am stumped. It seems that the keydown event is only available in the window/document object. Is this correct? Ive…
rabbitwerks
  • 285
  • 1
  • 3
  • 9
12
votes
3 answers

how to prevent default on keypress for certain event but then bring back the default again

I have been working on something that requires me to use the space bar to trigger an event. The thing I've been working on is much more complex but i've simplified it down to basics as an example of what I needed to do. The idea is that when the…
Suzi Larsen
  • 1,420
  • 5
  • 18
  • 32
12
votes
2 answers

How to listen keyboard events on svg

I have a svg and I can draw multiple shapes on this svg. Now my requirement is I want to listen keyboard events like ctrl+C, ctrl+V, ctrl+D, Esc, Delete so that I can copy, paste , duplicate selected shape. But I have no idea about listening…
Harshal
  • 961
  • 1
  • 11
  • 26
1 2
3
95 96