ASPxClientUtils.StringToShortcutCode(shortcutString) Method
Returns a specifically generated code that uniquely identifies the combination of keys specified via the parameter.
Declaration
static StringToShortcutCode(
shortcutString: string
): number
Parameters
Name | Type | Description |
---|---|---|
shortcutString | string | A string value that specifies the key combination. |
Returns
Type | Description |
---|---|
number | The code uniquely identifying the key combination. |
Remarks
If your application logic requires using shortcuts, you need to create a set of shortcuts, and then identify whether the currently pressed key combination corresponds to any defined shortcut.
The StringToShortcutCode assists in creating a unique code, identifying a custom combination of keys. You can store this identifier in any appropriate storage on the client side (for example, using an ASPxHiddenField control). When an end-user presses a key or key combination, you can compare this stored identifier with the code of the key combination pressed by the user, to find out whether the user is attempting to invoke the predefined shortcut. In order to obtain the code of the key combination pressed by the user, the ASPxClientUtils.GetShortcutCodeByEvent method can be used.
Note that the key names of the key combination passed via the StringToShortcutCode method’s shortcutString parameter should be separated by “+” (the PLUS SIGN). The key names are not case-sensitive. For instance, the following combinations are valid: “CTRL+SHIFT+A”, “alt+b”, etc.