keyboard-events

How to tap/hook keyboard events in OSX and record which keyboard fires each event

為{幸葍}努か 提交于 2019-11-30 09:14:43
问题 I've now discovered how to hook/tap keyboard events on OS X at a low level: How to tap (hook) F7 through F12 and Power/Eject on a MacBook keyboard Printing out the code from that answer: // compile and run from the commandline with: // clang -framework coreFoundation -framework IOKit ./HID.c -o hid // sudo ./hid // This code works with the IOHID library to get notified of keys. // Still haven't figured out how to truly intercept with // substitution. #include <IOKit/hid/IOHIDValue.h> #include

iPad split-keyboard

百般思念 提交于 2019-11-30 09:06:58
I am creating an app similar to the iPad's iMessage app that does messaging. So there is an input view anchored at the bottom of the message view and input accessory view when the keyboard is shown. Also the message view must be resized properly when the keyboard is shown while docked or undocked. The problem I have is that the notification data that comes in from UIKeyboardWillChangeFrameNotification is not consistent. First, there are 3 ways that the user can undock the keyboard: Press-and-hold the lower right key, then slide up Press-and-hold the lower right key, when the menu pops up,

Alternative for event's deprecated KeyboardEvent.which property

馋奶兔 提交于 2019-11-30 07:38:11
MDN states that KeyboardEvent.which is deprecated. How can I substitute it for a non-deprecated version? For example, I have the following: window.onkeydown = (event) => { console.log(event.which); } I thought event.key.charCodeAt() could substitute event.which , but this won't work for keys such as ALT , CTRL or ENTER , and it only works if event.key.length === 1 : window.onkeydown = (event) => { console.log(event.key.charCodeAt()); } To recap, event.which != event.code and event.which != event.key , therefore I am unable to simply use event.key . Is there a substitute for event.which which

How can I generate a keyup event with a specific keycode in IE8?

走远了吗. 提交于 2019-11-30 07:32:42
问题 I need to generate keyup events in IE 8 using native DOM functions (no jQuery). The following code generates, fires, and receives the event, but the keyCode is always 0. How do I properly pass the keyCode? <form><input id="me" type="submit" /></form> <script type="text/javascript"> var me = document.getElementById("me"); me.attachEvent("onkeyup", function(e) { alert(e.keyCode); // => 0 }); document.getElementById("me").fireEvent('onkeyup', 13); </script> 回答1: Figured it out. The solution is

Is it OK to ignore keydown events with keyCode = 229?

旧巷老猫 提交于 2019-11-30 05:13:58
At the beginning I wanted to monitor changes to a <input type="text"> in real time (for example, exactly when the user presses a key). The onChange event did not work because it is triggered only when the user presses Enter or removes focus from the input element. Then I saw this question on StackOverflow. I tried the code from that answer but the problem is that I do not want to be notified for key presses that do not represent printable characters, so I had to modify it in this way to make it verify that there are printable characters in the events: ... textInputElement.onKeyDown.listen(

Equivalent to a keypreview property in WPF

北城余情 提交于 2019-11-30 03:49:57
问题 I'm pondering taking the plunge to WPF from WinForms for some of my apps, currently I'm working on the combined barcode-reader/text-entry program (healthcare patient forms). To be able to process the barcode characters, I rely on the Keypreview property in WinForms (because barcodes can be scanned regardless of what control has the focus). But I cannot seem to find a KeyPreview property in neither VS2008 or VS2010, for a WPF app. Is there an alternative approach/solution to handle my barcode

How to find the key code for a specific key

孤街醉人 提交于 2019-11-30 02:22:18
What's the easiest way to find the keycode for a specific key press? Are there any good online tools that just capture any key event and show the code? I want to try and find the key codes for special keys on a mobile device with a web browser, so an online tool would be great. Bertrand Marron $(function () { $(document).keyup(function (e) { console.log(e.keyCode); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> Here's your online tool. Ahmet Kakıcı Just googled and result function displayunicode(e) { var unicode = e.keyCode ? e.keyCode : e

Detecting the user pressing F10 in WPF

我怕爱的太早我们不能终老 提交于 2019-11-30 00:53:06
问题 My WPF application has behaviour triggered by the functions keys ( F1 - F12 ). My code is along these lines: private void Window_KeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.F1: ... case Key.F2: ... } } This works for all F-keys except F10 . Debugging, I find that e.Key == Key.System when the user presses F10 . In the enum definition, F10 = 99 and System = 156 , so I can rule out it being a duplicate enum value (like PageDown = Next = 20 ). So, how do I tell when the

Need to intercept HID Keyboard events (and then block them)

旧城冷巷雨未停 提交于 2019-11-29 22:27:31
I've got a RFID USB device that registers as a HID device (A USB Keyboard more or less). I'm looking for a way to capture this input, and block/filter it before it hits the normal keyboard event handler (and outputs the 10 digit RFID code to the console). I would of course have to exclusively capture just this device, and leave the real keyboard input alone (or pass it along). My initial idea was to block the device in UDEV (So the usbhid/event/kbd kernel module didn't bind to it) and write my own basic driver for this device - but I don't know where to begin, or if that'll even work. What

Accessing Keys from Linux Input Device

南笙酒味 提交于 2019-11-29 19:34:25
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 running. So, in short, my requirements are these: Works on Linux Does not need X11 Can retrieve modifier key press without any other keys being pressed This includes the following keys: Shift Control Alt All I need is a simple 0 = not pressed , 1 = currently pressed to let me know if the key is being held down when the keyboard is checked My computer setup