keyboard-events

How to generate key strokes events with the Input Subsystem

扶醉桌前 提交于 2021-02-19 06:15:47
问题 I am writing a Key board emulator program in Linux, As a start I was able to render key strokes into X11 window but this is not working in virtual terminals and try out a different way. I referred to http://thiemonge.org/getting-started-with-uinput and tried with uinput kernel module. According to the tutorial key strokes can be injected as a uinput event and I wrote below code accordingly. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h>

Multiple keys with WPF KeyDown event

僤鯓⒐⒋嵵緔 提交于 2021-02-19 04:16:06
问题 I'm working with WPF KeyDown event (KeyEventArgs from Windows.Input). I need to recognize when user pressed F1 alone and Ctrl+F1. private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key==Key.F1 && Keyboard.IsKeyDown(Key.LeftCtrl)) { MessageBox.Show("ctrlF1"); } if (e.Key == Key.F1 && !Keyboard.IsKeyDown(Key.LeftCtrl)) { MessageBox.Show("F1"); } } My problem is that when I press Ctrl+F1 plain F1 messagebox would fire too. I tried to add e.Handled to Ctrl+F1 case, but it doesn't

Multiple keys with WPF KeyDown event

对着背影说爱祢 提交于 2021-02-19 04:12:20
问题 I'm working with WPF KeyDown event (KeyEventArgs from Windows.Input). I need to recognize when user pressed F1 alone and Ctrl+F1. private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key==Key.F1 && Keyboard.IsKeyDown(Key.LeftCtrl)) { MessageBox.Show("ctrlF1"); } if (e.Key == Key.F1 && !Keyboard.IsKeyDown(Key.LeftCtrl)) { MessageBox.Show("F1"); } } My problem is that when I press Ctrl+F1 plain F1 messagebox would fire too. I tried to add e.Handled to Ctrl+F1 case, but it doesn't

Python Turtle Graphics Keyboard Commands

ぐ巨炮叔叔 提交于 2021-02-18 08:37:40
问题 Anybody have any insight into controlling turtle graphics in python 2.7 with keyboard commands? I have done extensive research on this website and others and feel like I am doing the right thing but it just doesn't want to work for me. Below is what I have so far, can anyone tell me where I am going wrong???? from turtle import * turtle.setup(500, 500) wn = turtle.Screen() wn.title("Turtle Keys") move = turtle.Turtle() showturtle() def k1(): move.forward(45) def k2(): move.left(45) def k3():

Keyboard input in Java Applet

好久不见. 提交于 2021-02-16 18:07:14
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

Keyboard input in Java Applet

為{幸葍}努か 提交于 2021-02-16 18:06:53
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

Keyboard input in Java Applet

三世轮回 提交于 2021-02-16 18:06:49
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

Keyboard input in Java Applet

China☆狼群 提交于 2021-02-16 18:05:44
问题 What is the best way to listen for keyboard input in a Java Applet? I have an applet which opens a JFrame and I am using a KeyListener to listen for keyboard input. This works fine in my development environment (eclipse), but when I run the applet through a browser (I have tried Firefox and IE) it does not respond to keyboard events. However, if I run the applet and then minimize and maximize the frame, it works. I have tried setting focus to the JFrame in many different ways and also

How to determine if Pressed key is Underscore Or Minus? C#

北城余情 提交于 2021-02-10 05:10:46
问题 The problem is that for both underscore and minus the keyvalue is 189, and the keycode is Keys.OemMinus. So I am unable to check whether pressed key is underscore or minus. Please Help. private void Some_KeyDown(object sender, KeyEventArgs e) { if(Pressed key is minus/dash) { MessageBox.Show("minus"); } if(pressed key is underscore) { MessageBox.Show("underscore"); } } 回答1: If this is a WinForms project, use the KeyPress event instead of the KeyDown event: private void textBox1_KeyPress

Elm - textarea selection range disappearing

大城市里の小女人 提交于 2021-02-07 14:32:21
问题 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