hotkeys

Detect shift key on application startup in C#/Windows Forms

随声附和 提交于 2019-12-23 18:42:29
问题 Is there a way to get a standard Windows Forms application to detect if the Shift key is being held down on application startup - without using Windows hooks? I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. 回答1: Here is an article about reading the key states (and mouse) directly. 回答2: The ModifierKeys property looks ideal: private void Form1_Load(object sender, EventArgs e) { if ( (ModifierKeys & Keys.Shift) != 0) { MessageBox

Setting Mnemonics and Hot Keys for a JOptionPane Dialog

吃可爱长大的小学妹 提交于 2019-12-22 08:59:55
问题 Is it possible to assign hotkeys and mnemonics to the buttons in a JOptionPane Dialog? I'd like to be able, in a JOptionPane generated message dialog with the options Yes, No and Cancel, press Y to hit the Yes button, N to hit the No button and escape to activate the escape button. Similarly in a dialog with Okay and Cancel buttons I'd like to be able to activate them with enter and escape. I've attempted passing JButtons into the JOptionPane's button Object array with the Mnemonics set

Register hotkey with only modifiers in Linux

若如初见. 提交于 2019-12-22 08:28:51
问题 I'm using this sample to set hotkey in my program in Linux X11 graphic system. The problem is i don't understand how to set hotkey combinations like Ctrl + Alt and Ctrl + Shift , i.e. without any key, only modifers. I'm trying like this: KeyCode key = XKeysymToKeycode(display, 0); //no key code XGrabKey(display, key, ControlMask | ShiftMask, grabWin, true, GrabModeAsync, GrabModeAsync); But it's not working. However, it is working like this (kind of): KeyCode key = XKeysymToKeycode(display,

Gnome Shell Extension Key Binding

假如想象 提交于 2019-12-22 05:26:20
问题 What is the simplest way to (globally) bind a key combination (e.g. <Super>+A ) to a function in a gnome shell extension? Inspecting a couple of extensions, I ran into the following code: global.display.add_keybinding('random-name', new Gio.Settings({schema: 'org.gnome.shell.keybindings'}), Meta.KeyBindingFlags.NONE, function() { /* ... some code */ }); I understand that the key combination is specified by the schema parameter, and that it's possible to create an XML file describing the

Is there a way to capture HotKeys/Shortcuts in Excel VSTO using only C# and no VBA?

混江龙づ霸主 提交于 2019-12-22 04:44:16
问题 So I want to capture some key-commands in our Docuement-level Excel VSTO addin. I can't seem to find a way to do it, other than to use VBA and have our addin talk to the VBA. Any help/examples would be greatly appreciated. I am using Excel 2007. 回答1: You can only do this through API calls to subclass Excel and watch for key commands. This is older, but it still applies. 回答2: One method involves using the 3rd party solution from Addin-Express . Their product includes the ability to add a

Hotkey to remap keys does not trigger hotstring

断了今生、忘了曾经 提交于 2019-12-22 00:06:50
问题 I have a hotkey and hotstring that don't seem to work together: 9::( :?ob0:(::){left 1} To give some context, in one part of the code I remapped all the symbols to the number below them and vice versa so 9 prints the parenthesis ( . Later on I put a hotstring that would type a closed parenthesis after an open one and then places the cursor in between. Seems simple enough because they both work individually but together when I press the key for 9 and press the Spacebar I only get the open

NSEvent addGlobalMonitorForEventsMatchingMask: Hotkey Intercepting

心不动则不痛 提交于 2019-12-21 22:32:34
问题 I wanna intercept hotkeys that begin with Control + Shift and ends with a character (mandatory). I have the following code: [NSEvent addGlobalMonitorForEventsMatchingMask:NSFlagsChangedMask handler: ^(NSEvent *event) { NSUInteger flags = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask; if(flags == NSControlKeyMask + NSShiftKeyMask){ NSLog(@"pressed!"); } }]; What do i need to add to my code to check if the user pressed Control Shift +character, and what character the user pressed

Is there a command in Xcode 4.2 to swap two views in Assistant Editor mode from left to right and vice versa?

╄→尐↘猪︶ㄣ 提交于 2019-12-20 08:53:08
问题 I would like to quickly swap two views from one side to the other and wonder if there is a hotkey for this functionality? 回答1: Single Assistant Editor This can be done in two steps. You can start with the cursor in either the Primary or the Assistant editor. Step 1: ⌥ ⌘ , - Open in Assistant / Primary Editor It opens the current file (where the cursor is) in Primary Editor if you are in Assistant Editor and vice versa. You end up with two exact same files open. Step 2: ^ ` - Move Focus to

Disable CMD+Tab application switcher

ⅰ亾dé卋堺 提交于 2019-12-18 16:53:48
问题 I'm trying to disable the CMD + Tab application switcher, so that my application can register that hotkey. I'm looking for something that applications like Witch and LiteSwitch X are able to do (i.e. allow users to use CMD + Tab as the hotkey for my application). How are they able to do that? 来源: https://stackoverflow.com/questions/3256651/disable-cmdtab-application-switcher

Is there any shortcut for CodeBlocks to format the code?

雨燕双飞 提交于 2019-12-18 14:05:18
问题 Is there any shortcut for CodeBlocks to format the code? I haven't find any tip in google. I found only "format use AStyle", but it come up with right mouse button only... 回答1: probably not by default but you should be able to assign it there: Settings -> Editor -> Keyboard shortcuts -> Plugins -> Source code formatter (AStyle) 回答2: My favourite = Ctrl + A then Ctrl + Shift + F . You (these are the default settings I believe) can select a block of code and press the Tab key. This will indent