Show: Delphi C++
Display Preferences

Vcl.Menus.ShortCut

From XE2 API Documentation
Jump to: navigation, search

Delphi

function ShortCut(Key: Word; Shift: TShiftState): TShortCut;

C++

extern PACKAGE System::Classes::TShortCut __fastcall ShortCut(System::Word Key, System::Classes::TShiftState Shift);

Contents

Properties

Type Visibility Source Unit Parent
function public
Vcl.Menus.pas
Vcl.Menus.hpp
Vcl.Menus Vcl.Menus

Description

Creates a menu shortcut for a specified key combination.

Call ShortCut to create a menu shortcut at run time.

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

Specify the values for the SHIFT, CTRL, and ALT keys by using a set of type System.Classes.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.

See Also


Code Examples

Personal tools
Previous Versions
Translations