RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMenuItem.ShortCut Property

Specifies the key combination users can type to quickly access the menu item.

Pascal
property ShortCut: TShortCut;
C++
__property TShortCut ShortCut;

Use ShortCut to allow the user to type a key combination instead of selecting the item using the menu. This key combination appears to the right of the menu item in the menu. 

When setting menu shortcuts at design time, the Object Inspector provides a long list of key combinations to choose from. To create menu shortcuts at runtime, use the global ShortCut or TextToShortCut function. For example, the following line creates a shortcut, Ctrl+C and assigns it to a menu item named CloseCommand.

CloseCommand.ShortCut := ShortCut(Word('C'), [ssCtrl]);

 

CloseCommand->ShortCut = ShortCut(Word('C'), TShiftState() << ssCtrl);

Note: This property is not stored with the menu item if it is supplied by a TAction object.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!