Skip to main content
A newer version of this page is available. .

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

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

Declaration

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

Parameters

Name Type Description
keyCode number

An integer value that specifies 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

Type Description
number

An integer value that represents 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.

For more details on how to work with shortcuts on the client side, refer to the following Code Central example: E1137.

See Also