keyboard-events

Elm - textarea selection range disappearing

 ̄綄美尐妖づ 提交于 2021-02-07 14:31:33
问题 I implemented a <textarea> in Elm such that tabs indent and unindent instead of change focus to another HTML element. Works great except that unindenting sometimes causes the selection to disappear! If I'm selecting the 5th character to the 12th character, I press shift - tab , then it removes 2 tab characters, but it also makes the selection change to a cursor at position 10. The selection range should remain the same.. I have an SSCCE at Ellie: https://ellie-app.com/3x2qQdLqpHga1/2 Here are

Sending keyboard events to another application in C# that does not handle Windows events

白昼怎懂夜的黑 提交于 2021-02-06 10:16:05
问题 here is my situation: we are writing an application that must transform Microsoft Kinect coordinates into keyboard and mouse events. When we need to take control of the mouse, everything works as we intended in ANY kind of application. The problem arises when we need to send keyboard events (like key down or key up) to applications that doesn't handle Windows events, like games, for example. We tried the SendKeys class of the .net framework, and it only works with Windows applications. When

Pygame knowing when shift+other key is pressed

这一生的挚爱 提交于 2021-02-05 06:49:46
问题 I am trying to create a program similar to Microsoft word, only heavily simplified. I need to be able to know when shift+(any key) is pressed, and display the proper value for what was pressed (changed from just the normal key by the shift). Currently, my best method is simply to find if a shift key is pressed, then whenever another key is pressed altering the number output from the pressed key to a new value that I can call chr() to change it into the shifted value for that key. import

JavaScript keep track of which keys are down accurately

天涯浪子 提交于 2021-01-29 11:13:27
问题 I have a web app that's running a 60FPS loop forever and I sometimes want to check whether a key is down now. So I made var keydown = [] window.addEventListener("keydown", function(e){keydown[e.keyCode]=true}) window.addEventListener("keyup", function(e){keydown[e.keyCode]=false}) function loop() { if(keydown[17]) console.log("Control is down.") if(keydown[71]) console.log("F is down.") } setInterval(loop, 16) The problem is that if the user presses control+F to search the page, then when

Understanding multiple keys with WPF KeyDown event

Deadly 提交于 2021-01-28 18:14:30
问题 I'm using WPF KeyDown event. Can you please explain why this condition is true, when I press Ctrl + F1 ? When I press F1 , Ctrl is already pressed so !Keyboard.IsKeyDown(Key.LeftCtrl) should be false. Edit: In the code below if you press Ctrl + F1 both messages would fire. But if you change the order of these two if statements, only "ctrlF1" message would fire like it should be. I would like to get explanation of that strange behavior. private void Window_KeyDown(object sender, KeyEventArgs e

Understanding multiple keys with WPF KeyDown event

谁都会走 提交于 2021-01-28 18:08:51
问题 I'm using WPF KeyDown event. Can you please explain why this condition is true, when I press Ctrl + F1 ? When I press F1 , Ctrl is already pressed so !Keyboard.IsKeyDown(Key.LeftCtrl) should be false. Edit: In the code below if you press Ctrl + F1 both messages would fire. But if you change the order of these two if statements, only "ctrlF1" message would fire like it should be. I would like to get explanation of that strange behavior. private void Window_KeyDown(object sender, KeyEventArgs e

Java KeyBindings input delay

随声附和 提交于 2021-01-28 13:54:19
问题 I wasn't quite sure how to word the title of this question. Basically I'm making space invaders with JFrames, and using KeyBindings for keyboard input. The keybindings work fine, and I can move the ship around without a problem. However, if I hold down a key, the ship moves 5 pixels and then pauses for about half a second, after which it moves smoothly. When the key is pressed, my code increases the ship's speed (which moves the ship by 5-10 pixels every frame). I'm assuming this is a common

C#_ Making buttons be pressed by either mouse or keyboard

房东的猫 提交于 2021-01-28 05:41:57
问题 Ok, so in my program I tried making buttons and assigning different methods for each button pressed. But I came into a problem where I also want the user to use his keyboard and assign buttons pressed on keyboard into same buttons on screen. Yet firstly, I tried if button is pressed by mouse or keyboard yet the method doesn't allow KeyEvents in 'EventArgs' (which is fine by me), so I created different method and made a boolean variable so that if in that separate method the key is pressed,

C++ getting keyboard adapter when using two keyboards, determine where the keypress come from

穿精又带淫゛_ 提交于 2020-12-15 05:24:57
问题 I would like to know how to detect the keyboard adapter on Windows when using two keyboards, that a key eg. W was pressed on first or on the second keyboard. Can anybody help me how to do it? I would like to use a cheap solution for macros. I would plan to bind macros for entrie second keyboard, when somebody press key W (just for example), keybaord would type a world uint8_t. 来源: https://stackoverflow.com/questions/61139696/c-getting-keyboard-adapter-when-using-two-keyboards-determine-where