Home > Services > DXCore Services – Key (Keyboard)

DXCore Services – Key (Keyboard)

June 28th, 2011

The Key DXCore service provides access to keystrokes, key names, and key mapping methods and properties. This service can be used for retrieving shortcuts bound to the specific actions or an entire shortcut binding scheme that you can see on the Shortcuts options page.

Methods of the Key service:

Name Description
ActionToKeyNames(String) Returns a list of key names associated with the passed Action.
CodeToString(UInt32, UInt32) Returns a string presentation of the specified virtual key and scan code.
GetAllBindings Returns an array of all registered command key bindings.
GetAllBindings(String) Returns a NameValueCollection of key names and bindings associated with the passed command. If the command specifies no parameters, and bindings exist to the command that accept parameters, all key bindings will be returned. The Name field holds the key name, and the Value field holds the command with any parameters (e.g., “Embed(try/finally)”).
GetAllContextMatchBindings Returns a NameValueCollection of key names and context satisfied bindings associated with the passed command. If the command specifies no parameters, and bindings exist to the command that accept parameters, all key bindings will be returned. The Name field holds the key name, and the Value field holds the command with any parameters (e.g., “Embed(try/finally)”).
GetAsyncKeyState(Int32) Determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
GetName Returns a string that is the name of a key for the current locale.
HasEnabledShortcut Determines if the specified command has at least one DXCore shortcut that is enabled.
MapVirtual(Int32) Translates (maps) a scan code into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.
MapVirtualLeftRight(Int32) Translates (maps) a scan code into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.

Properties:

Name Description
AltKeyName Returns the name of the Alt key.
CtrlKeyName Returns the name of the Ctrl key.
SendShortcutToIDE Command event handlers can change this property to determine whether the key bound to their CodeRush command should go on to the IDE for further processing. This property is initialized by DXCore before calling the CodeRushCommand’s DoExecute() method. The initialized value is determined by the user-specified binding option established in the Shortcuts option dialog. This property is checked immediately after calling DoExecute(), so if your event handler doesn’t touch it, it will respect the user’s settings.
ShiftKeyName Returns the name of the Shift key.
WaitingForSecondKeyOfChord Returns true if the Visual Studio IDE is waiting for a second key of chord (used for multiple key shortcuts, VS is waiting for a second part of a key combination).
—–
Products: DXCore
Versions: 12.1 and up
VS IDEs: any
Updated: Jun/09/2011
ID: D096

Similar Posts: