keyboard-events

Can one of the Shift, Ctrl, Alt or Win keys be used in other purpose like, to type text?

走远了吗. 提交于 2019-12-13 00:05:48
问题 I want to modify the use of the one of the Shift , Ctrl , Alt or Win keys. For example, if I just hit (not hold it and press another key) the right shift key, it should do something like displaying a special character in a text box. Could some one let me know if this is possible using any programming language like Java? 回答1: Yes, you can do that. Check this tutorial on how to write a Key Listener in Java + Swing . Another interesting tutorial about Key Bindings in Java + Swing that could also

Try to implement global keyboard shortcut in MDI parent/child form and other form by using ProcessCmdKey

这一生的挚爱 提交于 2019-12-12 21:17:08
问题 I override ProcessCmdKey() in my MDI parent form class and have some keyboard shortcut calling method in same class. But I wish to make these hotkeys working in parent/child form and other form. The case now is when focus on the other form(regular form, not MDI), ProcessCmdKey() doesn't capture keyboard anymore. Which class should I put ProcessCmdKey() in and anything to make it work? Thanks! namespace myNamespace { public class MDIParent : System.Windows.Forms.Form { public bool NextTab(){..

How to post Extended ASCII chars (0x80 to 0xFF) using PostMessage in Delphi?

倖福魔咒の 提交于 2019-12-12 17:50:41
问题 I am writing a Keyboard Mapper Application in which I need to send Extended ASCII chars (0x80 to 0xFF) to Current Window. I have tried everything like below function ConstructLParam(vKey: Word): LongInt; // Cardinal; begin { ConstructLParam } if vKey > $FF then Result := LongInt(MapVirtualKeyW(vKey, 0) and $00000FFF or $F000) shl 16 or 1 else Result := LongInt(MapVirtualKey(vKey, 0) and $000000FF or $FF00) shl 16 or 1; end; { ConstructLParam } procedure PostCharacter(TargetWinHandle: Hwnd;

keyboardWillShow fire twice

随声附和 提交于 2019-12-12 14:10:45
问题 I'm stuck with problem "keyboardWillShow" fires twice, but the "keyboardWillHide" called once. Here is an example where I'm printing the keyboard sizes as soon as "keyboardWillShow" fires. I've also put breakpoint in "viewDidLoad" and the observer registers only once. I've added two elements "UITextField" and "UITextView" and for both it is the same behaviour. I'm using iOS 9.2, swift lang., xcode 7 Below my ViewController class ViewController: UIViewController { override func viewDidLoad() {

keyDown event is not fired for Capslock in Mac

眉间皱痕 提交于 2019-12-12 13:41:44
问题 CHROME (52): When turning caps lock ON - only keydown is fired (no event in keyUp or keyPress) When turning caps lock OFF - only keyup is fired (no event in keyDown or keyPress) FIREFOX (46): Only keyDown event is fired for both caps lock ON & OFF (no keyUp or keyPress) I've read about the keyCodes and events here http://www.quirksmode.org/js/keys.html and in MDN here https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode, aaaand here http://unixpapa.com/js/key.html But none

Why does UIElement.MoveFocus() not move the focus to the next sibling element in a ListBox?

爱⌒轻易说出口 提交于 2019-12-12 12:29:03
问题 I have the following visual tree: <DockPanel> <TextBox Name="ElementWithFocus" DockPanel.Dock="Left" /> <ListBox DockPanel.Dock="Left" Width="200" KeyUp="handleListBoxKeyUp"> <ListBoxItem>1</ListBoxItem> <ListBoxItem>4</ListBoxItem> <ListBoxItem>3</ListBoxItem> <ListBoxItem>2</ListBoxItem> </ListBox> <TextBox DockPanel.Dock="Left" /> </DockPanel> handleListBoxKeyUp is the following: private void handleListBoxKeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { ((UIElement)sender)

Capturing media keys (play/pause) in OSX

99封情书 提交于 2019-12-12 12:13:17
问题 The research, the problems, the mid-age crisis There are some questions here and there about capturing the play/pause events. The solution usually relies on extending NSApplication and capturing the sendEvent. However, there are two problems with that: The iTunes opens OR some apps capture it before (Spotify I am looking at you). Damn you spotify More people were bored with iTunes opening using the play/pause, and posted in the stackoverflow. However, the solution still gets beaten by spotify

Simulate Enter In JavaScript

自古美人都是妖i 提交于 2019-12-12 10:46:00
问题 I try to simulate Enter in JavaScript in a specific TextArea . This is my code: function enter1() { var keyboardEvent = document.createEvent('KeyboardEvent'); var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? 'initKeyboardEvent' : 'initKeyEvent'; keyboardEvent[initMethod]('keydown', // event type : keydown, keyup, keypress true, // bubbles true, // cancelable window, // viewArg: should be window false, // ctrlKeyArg false, // altKeyArg false, // shiftKeyArg false, //

Firing ctrl+r, ctrl+a, ctrl+q events on a button click

别来无恙 提交于 2019-12-12 08:53:49
问题 I need to fire the Ctrl + R , Ctrl + A , Ctrl + Q events when a user clicks on a button. I was working on the following code: $(document).ready(function () { $('#Button1').click(function () { var evt = $.Event("keypress"); evt.keyCode = 81; evt.ctrlKey = true; evt.shiftKey = true; $(document).trigger(evt); }); }); 回答1: You can't simulate browser control keys, but you can simulate their effects. Ctrl - R refreshes. function refresh() { location.reload(true); } Ctrl - A selects everything. Code

Javascript - get key description for any keyboard layout

寵の児 提交于 2019-12-12 08:30:03
问题 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