Key
Key
Specifies the accelerator key for the menu item
Integer property
Applies to: MenuItem
Introduced in KCML version 5.03
Key
Specifies the accelerator key for the button
Integer property
Applies to: Button , Picture Button
Introduced in KCML version 6.00
The Key property is used to define a short cut key for a menu item. It is more powerful than the use of '&' to denote accelerators on controls as it can be used to specify most of the keys on the keyboard, together with the Shift, Ctrl and Alt key status (at least one of these must be included. The text of the menu item is changed to reflect the short-cut key available. It can be set at design time using the menu editor or it can be set programmatically during the enter event.
The value is set using the integer form of the two byte hex string 0xkkss, where kk is the virtual-key code and ss is the shift status. This is the same format as used to specify a windows key in the KCML 5.03 enhanced $KEYBOARD statement.
A similar property is available for buttons.
To set a menu item to be accelerated by the End key a programmer might code in the Enter() event
.menu.PrintButton.key=0x2300The following table lists most of the likely needed values.
Virtual-Key Code Definitions
The following table includes the virtual-key codes that are defined for Windows. The key code values 0x00 and 0xFF are not used.
First byte | Second byte | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Button
The Key property is used to define a short cut key for a button.
This example shows how the shift F6 key may be used as an accelerator for a button
Form1.ActionIt.key = 0x7501