Skip to main content

commandKeyDown

Type​

message

Summary​

Sent when a Command key combination (Control-key on Unix or Windows) is pressed.

Syntax​

commandKeyDown <pKeyName>

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 (focused) control(glossary), or to the current card if no control is focused.

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 systems, the commandKeyDown message is sent when the user presses a key while holding down the Command key. On Unix or Windows|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.

Parameters​

NameTypeDescription

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

control structure: function

function: commandKey, controlKey, menus

glossary: current card, key combination, handler, Windows, message, Command key, Mac OS, Unix, focus, active control

keyword: control

message: functionKey, enterKey, arrowKey, deleteKey, tabKey, backspaceKey, controlKeyDown, optionKeyDown, returnKey

object: button

Compatibility and Support​

Introduced

LiveCode 1.0

OS

mac

windows

linux

Platforms

desktop

server

Thank you for your feedback!

Was this page helpful?