hotkeys

Making “global” hotkeys in WPF

匆匆过客 提交于 2019-12-08 06:38:17
问题 I'm programming an application consisting of three usercontrols in an main window. In one of the usercontrols, there's a slider that needs to be controllable by keyboard input. The left arrow should decrease value, right button increase and so on. I have this work, but only when the slider has focus. If some other control has focus, I cant make it work at all. Is it possible to define "global" hotkeys? IE keys that trigger the same event or function, no matter where the focus is? Hope I've

Programatically get/set Mac OSX default system keyboard shortcut

▼魔方 西西 提交于 2019-12-08 06:30:20
问题 I'm trying to find a way to programatically get/set the default OSX system keyboard shortcuts (hotkeys) found in the System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts tab. I need to be able to do this in the background, so GUI scripting is not a solution. I'm unable to find a plist or anything where this info might be stored. I tried using Instruments "File Activity" trace while using System Preferences, but again came up empty handed. Any help is appreciated. 回答1: There is an API

WPF hot key firing without modifier

大城市里の小女人 提交于 2019-12-08 05:57:11
问题 I have a WPF window, which contains a button called Cancel. Under ordinary circumstances I want a user to be able to press Alt+C to cancel their actions and close the program. As such, the button is captioned "_Cancel." Problem 1: During Window_Load, if I press C without modifiers, the Cancel_Clicked event fires, and the program closes. Problem 2: After my program opens, assuming I don't interact with anything on the window, pressing C without modifiers will close the program. Note that, due

Is there a way to trigger a Hot Key/Keyboard Shortcut via a Shell Script, a AppleScript or a Automator Workflow?

眉间皱痕 提交于 2019-12-08 05:17:21
问题 I'm an avid Keyboard Maestro user and I need a workaround for triggering a keyboard shortcut like ⌘⇧L (externally, without Keyboard Maestro). So I thought a bash script would be capable of doing such a thing. An AppleScript or an Automator workflow would be sufficient, too. I anybody could help me this would be great. You don't have to read this, but here's why I want to do what I want to do: I have a the same string assigned to various Markdown macros, I use a string instead of Hotkeys

jquery hotkeys and CTRL-C [duplicate]

对着背影说爱祢 提交于 2019-12-08 02:53:43
问题 This question already has answers here : How to detect that Ctrl+R was pressed? (10 answers) Closed 6 years ago . I am building a webapp where a user can click on any cell in a table. On click, the text of that cell is copied and will pop up inside a disabled textarea in a fancybox, and the textarea is selected in js. The user is then invited to hit CTRL-C to copy the text that is now inside the selected textarea. I would like to combine 2 things together when CTRL-C happens: (1) Copy the

Global hotkeys in WPF?

痴心易碎 提交于 2019-12-07 17:28:27
I've build a WPF application and want to add global hotkey support. I want to be able to execute a method in my application from anywhere in windows, even when my application is minimized or running in tray. For example, execute the method with ctrl + alt + t. Is this possible in WPF, and if so, how? You need to take a look at RegisterHotKey in user32.dll. Here's a good example at pinvoke.net: http://www.pinvoke.net/default.aspx/user32/RegisterHotKey.html 来源: https://stackoverflow.com/questions/4489118/global-hotkeys-in-wpf

What is the best way to add a custom key mapping in vim/vi? (Does there exist a unbound keyspace for customization?)

余生长醉 提交于 2019-12-07 13:00:38
问题 I know you can add custom keymappings to vim with imap in the .vimrc file. My question is, if one is to create additional custom operators, motions, commands and map them to keys, what is the best way to add them in so they don't conflict with existing bindings? An analogy, in emacs, a lot of custom key commands are added via the C-c sequence. To be more technical, are there unbound keys in vim that allow for user customization? In other words, is there a free keyspace available to users? 回答1

How to detect when a hotkey (shortcut key) is pressed

青春壹個敷衍的年華 提交于 2019-12-07 05:04:41
问题 How do I detect when a shortcut key such as Ctrl + O is pressed in a WPF (independently of any particular control)? I tried capturing KeyDown but the KeyEventArgs doesn't tell me whether or not Control or Alt is down. 回答1: private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.KeyboardDevice.Modifiers == ModifierKeys.Control) { // CTRL is down. } } 回答2: I finally figured out how to do this with Commands in XAML. Unfortunately if you want to use a custom command name (not one of

WPF hot key firing without modifier

旧时模样 提交于 2019-12-07 02:15:31
I have a WPF window, which contains a button called Cancel. Under ordinary circumstances I want a user to be able to press Alt+C to cancel their actions and close the program. As such, the button is captioned "_Cancel." Problem 1: During Window_Load, if I press C without modifiers, the Cancel_Clicked event fires, and the program closes. Problem 2: After my program opens, assuming I don't interact with anything on the window, pressing C without modifiers will close the program. Note that, due to problem 2, using some sort of boolean to track the "loaded" status won't work. What am I doing wrong

Using a hotkey to submit an HTML form?

被刻印的时光 ゝ 提交于 2019-12-07 02:10:30
问题 I have a very simple HTML form, only containing a submit button and a textarea. Is there an easy way to use a hotkey to submit this form, as an alternative to pressing the button? Thanks in advance :-) 回答1: Submit buttons can have accesskeys, but there are drawbacks. Users would probably be better off just hitting the tab key to focus the submit button, and then pressing enter. 回答2: you can use the "keyDown", "keyPress" events if you use a JS library (JQUERY or MOOTOOLS).. you can program