Sign in Join
FPDoc Onlineexperiment

TextToShortCut function

In unit LCLProc

Converts the textual representation for a shortcut to its TShortCut value.

Declaration

pascal
function TextToShortCut(const ShortCutText: string): TShortCut

Arguments

ShortCutText

Text converted to a shortcut value in the routine.

Function result

TShortcut value for the specified text.

Description

TextToShortCut is a TShortcut function used to convert the string representation for a shortcut (or accelerator) to a TShortCut instance.

ShortCutText contains the text which represents a key or a key combination used as a shortcut in an application. It can contain optional key modifier(s) as well as a key caption. For example:

Ctrl+V
Ctrl+Alt+Del
^V
Shift+F9
Alt+G
Meta+Q

Recognized key modifiers include:

Alt
Ctrl or ^
Meta
Shift

Recognized key captions include the standard key caps for your keyboard and the localized versions of the following:

BkSp
VK_BACK
Del
VK_DELETE
Down
VK_DOWN
End
VK_END
Enter
VK_RETURN
Esc
VK_ESCAPE
Help
VK_HELP
Home
VK_HOME
Ins
VK_INSERT
Left
VK_LEFT
PgDn
VK_NEXT
PgUp
VK_PRIOR
Right
VK_RIGHT
Space
VK_SPACE
Tab
VK_TAB
Up
VK_UP

The return value is a TShortCut instance with the numeric value used to represent both the Shift/Ctrl/Alt modifier and the key code for the shortcut. It consists of the Shift and Key values OR'd together.

Use TextToShortCutRaw to convert a non-localized string to it TShortCut equivalent.

Use ShortCutToText to reverse the process.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.