Sent when a Command key combination (Control-key on Unix or Windows) is pressed.
# Metadata
Platforms: desktop, server OS: mac, windows, linux Introduced: 1.0 Security:
# Syntax
commandKeyDown pKeyName
# Params
- pKeyName : The actual character of the pressed key.
# Examples
on commandKeyDown theKey -- make Command-5 go back if theKey is "5" then go recent card else pass commandKeyDown end commandKeyDown
# Description
Handle the commandKeyDown message if you want to provide Command-key or Control-key shortcuts (other than those provided in menus and button accelerators).
The commandKeyDown message is sent to the active control, or to the current card if no control is focus.
If the Command key is pressed along with the Return, Tab, Backspace, Delete, or Enter key, with an arrow key, or with a function key, no commandKeyDown message is sent. Instead, the returnKey, tabKey, backspaceKey, deleteKey, enterKey, arrowKey or functionKey message is sent. To trap a combination such as Command-Return or Control-Return, use a returnKey handler and check the commandKey function inside the handler.
>*Cross-platform note:* On Mac OS, the > commandKeyDown message is sent when the user presses a key while > holding down the Command key. On Unix or Windows systems>, the commandKeyDown message is sent when the user presses > the Control key, whether or not another key is pressed at the same > time.
# Tags
ui,
# See
- **keyword:** control - **control structure:** function - **message:** functionKey, enterKey, arrowKey, deleteKey, tabKey, backspaceKey, controlKeyDown, optionKeyDown, returnKey - **object:** button - **function:** commandKey, controlKey, menus - **glossary:** current card, key combination, handler, Windows, message, Command key, Mac OS, Unix, focus, active control