Back to Devexpress

ASPxClientUtils.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey) Method

aspnet-js-aspxclientutils-dot-getshortcutcode-dot-static-x28-keycode-isctrlkey-isshiftkey-isaltkey-x29.md

latest2.2 KB
Original Source

ASPxClientUtils.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey) Method

Returns a specifically generated code that uniquely identifies the combination of keys specified via the parameters.

Declaration

ts
static GetShortcutCode(
    keyCode: number,
    isCtrlKey: boolean,
    isShiftKey: boolean,
    isAltKey: boolean
): number

Parameters

NameTypeDescription
keyCodenumber

The code of the key. Codes are available via the ASPx.KeyCode client object’s members.

| | isCtrlKey | boolean |

true, if the CTRL key should be included into the key combination; otherwise, false.

| | isShiftKey | boolean |

true, if the SHIFT key should be included into the key combination; otherwise, false.

| | isAltKey | boolean |

true, if the ALT key should be included into the key combination; otherwise, false.

|

Returns

TypeDescription
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 somehow identify whether the currently pressed key combination corresponds to any shortcut defined.

The GetShortcutCode method 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 (using, for example, 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.

See Also

GetShortcutCodeByEvent.static

StringToShortcutCode.static

ASPxClientUtils Class

ASPxClientUtils Members