Questions tagged [keyboard-events]

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

A KeyboardEvent 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).

2201 questions
40
votes
1 answer

Accessing Keys from Linux Input Device

What I am trying to do So, I have been trying to access keyboard input in Linux. Specifically, I need to be able to access modifier key presses without other keys being pressed. Furthermore, I want to be able to do this without an X system…
Senkwich
  • 1,022
  • 1
  • 9
  • 17
36
votes
3 answers

How to grab keyboard events on an element which doesn't accept focus?

I know that for handling keyboard events in an input field you can use: $('input').keyup(function(e){ var code = e.keyCode // and 13 is the keyCode for Enter }); But, now, I have some div and li elements, and I don't have a form element, and none…
Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188
32
votes
3 answers

How to handle key press event in console application

I want to create a console application that will display the key that is pressed on the console screen, I made this code so far: static void Main(string[] args) { // this is absolutely wrong, but I hope you get what I mean …
R.Vector
  • 1,669
  • 9
  • 33
  • 41
32
votes
17 answers

How to set the textinput box above the Keyboard while entering the input field in react native

I am using react-native TextInput component. Here I need to show the InputBox above the keyboard if the user clicks on the textInput field. I have tried below but i am facing the issues 1. Keyboard avoiding view a. Here it shows some empty space…
sejn
  • 2,040
  • 6
  • 28
  • 82
29
votes
6 answers

Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'

I'm getting this error with Swift 4.2 Type 'NSNotification.Name' has no member 'keyboardDidShowNotification' Here is my code: NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name:…
Krunal
  • 77,632
  • 48
  • 245
  • 261
29
votes
3 answers

Detect a double key press in AutoHotkey

I'd like to trigger an event in AutoHotkey when the user double "presses" the esc key. But let the escape keystroke go through to the app in focus if it's not a double press (say within the space of a second). How would I go about doing this? I've…
Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
28
votes
6 answers

KeyboardEvent in Chrome, keyCode is 0

I am trying to set keyCode on dispatched event object . On button click, event is raised on textbox control to simulating keydown event. Event is raised successfully, but keyCode is 0. I need to send event object with correct keyCode to…
Andrija
  • 14,037
  • 18
  • 60
  • 87
28
votes
1 answer

How do you check for keyboard events with kivy?

So, awhile ago, I started teaching myself kivy. I started with the main kivy website and went through its pong making tutorial and upon finishing that I decided to try and give it key input. I just can't seem to find any kind of guide to key input…
Alex
  • 341
  • 2
  • 4
  • 6
27
votes
3 answers

How to get text cursor position after keypress event happened?

I am writing a syntax highlighter. The highlighter should update the highlighting immediately while entering text and navigating with the arrow keys. The problem I'm facing is that when the 'keypress' event is fired, you still get the old position…
Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132
27
votes
13 answers

Restricting input length and characters for Entry field in Xamarin.Forms

How can I restrict the length and characters entered in an Entry control in Xamarin.Forms. Do I need to create a custom control? Is there a way I can derive from Entry (or another control) so I can apply the necessary per-platform input…
Ken K
  • 799
  • 3
  • 9
  • 18
24
votes
3 answers

c# Sending keyboard commands to another window / process

I am trying to write a program that will take a line of data and pass it into another window / process. This is the code I have so far, but I have not been able to work out how I would send the keyboard command to the OUTLOOK process. I would like…
monkeylumps
  • 747
  • 4
  • 10
  • 23
24
votes
3 answers

FullScreen Swing Components Fail to Receive Keyboard Input on Java 7 on Mac OS X Mountain Lion

Update 12/21: 7u10 was recently released. Confirmed that: The issue still persists Thankfully, the workaround still functions! Update 11/7: And we have a workaround! Leonid Romanov from Oracle on the openjdk.java.net mailing list provided some…
Vermillion002
  • 261
  • 2
  • 7
21
votes
4 answers

Python cross-platform listening for keypresses?

I need to listen for certain keypresses in a python terminal program without pausing execution with raw_input. I've seen people use a few windows specific ways of listening for keystrokes and I've seen people use large modules like tkinter and…
rennat
  • 2,529
  • 3
  • 26
  • 30
20
votes
10 answers

NSNotificationCenter Swift 3.0 on keyboard show and hide

I am trying to run a function when the keyboard shows and disappears and have the following code: let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(ViewController.keyBoardUp(Notification…
Dhwanit Zaveri
  • 465
  • 1
  • 5
  • 15
20
votes
1 answer

Android custom keyboard popup keyboard on long press

I have custom Android keyboard: public class CustomKeyboard extends Keyboard{...} public class CustomKeyboardView extends KeyboardView{...} public class CustomKeyboardIME extends InputMethodService implements…