keyboard-events

Move focus in response to keyboard events in XAML

北战南征 提交于 2019-12-04 04:11:29
问题 I've got a WPF view with two textboxes. I'd like to automatically move focus forward from the first textbox to the second when the user hits the down arrow on the keyboard exactly like Tab does. It seems like I ought to be able to do this 100% declaratively, but for some reason the commands I thought would do this don't seem to do anything. Here is my first attempt that doesn't work: <StackPanel> <TextBox Text="Test"> <TextBox.InputBindings> <!-- I realize ComponentCommands.MoveFocusDown

Javascript - get key description for any keyboard layout

孤街醉人 提交于 2019-12-04 03:10:25
For a rich web application, I need keyboard shortcuts. Because there are many different keyboard layouts, they have to be configurable. Unfortunately, I can't figure out a way to map keyboard events to human-readable shortcut names such as Ctrl + Alt + Y or Alt + \ . The keypress event is useless since it doesn't fire for all keys. Here are some properties of keydown events: charCode : Works only for printable characters. Deprecated , according to MDN code : Works, but ignores the keyboard layout. When I press Z, I get code: "KeyY" on my German keyboard. key : Works, but gives different

Sending keypresses to JTextField

旧巷老猫 提交于 2019-12-03 22:48:07
问题 I'm trying to simulate text input into a JTextField . I've got a 1 char long string containing the letter I want to add and I run: receiver.dispatchEvent(new KeyEvent(this, KeyEvent.KEY_TYPED, 0, this.shifted?KeyEvent.SHIFT_DOWN_MASK:0, KeyEvent.VK_UNDEFINED, text.charAt(0))); But this doesn't seem to change the contents at all. What am I missing here? 回答1: Looks like a virtual keyboard to me :-) Almost the exact same code does work for me. I would suggest the following: Pass the target

How to create virtual keyboard in osx?

帅比萌擦擦* 提交于 2019-12-03 21:47:49
I want to create a virtual keyboard in osx. Is it possible? I mean can I make a program that gives same signals than real keyboard. Example of this kind of keyboard would be onscreen keyboard, or keybord viewer (does it have necessary interface btw). How low should I start? Should I make a device driver e.g. virtual (wireless) keyboard? Or does cocoa etc. have the necessary stuff? The requirements I have are: - a list of tuples (time, key_down/key_up, key_code) corresponds to person typing - virtual keyboard should work side by side with the real one (like touchpad and bluetooh mouse) - this

How to monitor the keyboard above all other applications and then send other keys to them instead

故事扮演 提交于 2019-12-03 21:18:40
I am building an multimedia console based on an old computer running Win7. I want to control the players with a numeric keyboard. I can't use the common media control devices because they respond only to windows media player. I will use the KVM Player, Winamp and others. So each one has it's own set of keyboard shortcuts for play, pause, foward, volume etc. For that I am thinking of building a Delphi application that detects the foreground application and gets from a database the shortcuts this application uses. When I use the numeric keyboard (the size of a regular remote control) and press 5

How to detect key press event and key hold down event without using pygame

不羁岁月 提交于 2019-12-03 20:48:33
I am currently looking for a library that is able to detect/monitor the keyboard. My intention is to detect when a key is being held down and while it occurs something should happen. Most SO posts suggest to use pygame, but i find it a bit too much, to involve a library such as that for this simple task. i've also tried with pynput , which resulted only detecting one press rather than a stream of presses. any suggestions on how i can make this while loop detect a key is being pressed / held down... My attempt with while loop: from pynput import keyboard def on_press(key): while key == keyboard

How to get in python the key pressed without press enter?

喜你入骨 提交于 2019-12-03 17:31:15
I saw here a solution, but i don't want wait until the key is pressed. I want to get the last key pressed. jsbueno The related question may help you, as @S.Lott mentioned: Detect in python which keys are pressed I am writting in, though to give yu advice: don't worry about that. What kind of program are you trying to produce? Programas running on a terminal usually don't have an interface in which getting "live" keystrokes is interesting. Not nowadays. For programs running in the terminal, you should worry about a usefull command line User Interfase, using the optparse or other modules. For

iPad, JavaScript character codes, and shiftKey

不想你离开。 提交于 2019-12-03 15:10:28
Say I have a web application that calls the following jQuery every time a user presses a key in a textarea with an ID of "txt": $('#txt').keydown(function(e) { console.log(e.which); // shows the keyCode console.log(e.shiftKey); } On a desktop browser, for characters like ( and 9 , I can distinguish between the two by checking to see if the shift key is held down (with e.shiftKey). However, in Safari for iPad, there is no shift key required to type those characters. So, for example, pressing both ( and 9 on the iPad's keyboard logs "57" in the console for the keyCode. The value logged for e

UISearchbar keyboard search button Action

空扰寡人 提交于 2019-12-03 14:28:02
问题 I'm using UISearchBar when I input text on UISearchBar the keyboard shows. At that time, keyboard return key is "Search". I want to implement event when I press the keyboard search button. How can I implement the action? On UITextField it has -(BOOL)textFieldShouldReturn:(UITextField *)textField; But on UISearchBar it doesn't have return action. Thank you for your helping. 回答1: Add UISearchBarDelegate in .h Also set SearchBar's object delegate to self. Add this to the UISearchBarDelegate's

Listening to keyboard events without trapping them?

≯℡__Kan透↙ 提交于 2019-12-03 11:43:21
问题 I'm writing an command-line application which listens for Control key release events in X Windows and alerts another process when it detects them. Being new to GNU/Linux, I'd prefer avoiding to fumble with GCC and therefore I'm looking for a scripting-based solution. Since I know a bit of Python, it seemed natural to go for a Python-based solution, and after scavenging the Internet for examples and reading Python Xlib docs, I've put together this programs which works, but with a caveat: it