RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Menus.ShortCut Function

Creates a menu shortcut for a specified key combination.

Pascal
function ShortCut(Key: Word; Shift: TShiftState): TShortCut;
C++
TShortCut ShortCut(Word Key, TShiftState Shift);

Menus

Call ShortCut to create a menu shortcut at runtime.  

Specify a Key value using a virtual key code (Menus version) or Qt key code (QMenus version). 

Specify the values for the Shift, Control, and Alt keys by using a set of type TShiftState. For example, to specify the Shift key, use the set [ssShift]. To specify a Shift and Ctrl key combination, use the set [ssShift, ssCtrl]. 

Assign the value returned by ShortCut as the value of the ShortCut property of a menu item.

Note: TextToShortCut can also create a shortcut. TextToShortCut converts a string to a shortcut, so it can be used to let the user specify the shortcut. However, TextToShortCut executes much more slowly than ShortCut. Use ShortCut whenever possible.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!