Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » commandKeyDown

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

commandKeyDown

commandKeyDown char

The commandKeyDown command provides a way of sending a Command-key event from a handler. It acts exactly as if you had pressed Command at the same time as the specified character.

HyperCard sends the commandKeyDown command to a field (if the insertion point is set) or to the current card when the user presses a Command-key combination. The value passed to the parameter variable char corresponds to the key pressed.

You can handle the commandKeyDown message as follows:

on commandKeyDown theKey
statements
end commandKeyDown

Note: commandKeyDown is not sent for characters typed using the type command.

Examples

commandKeyDown "V" -- paste; same as type "v" with commandKey
commandKeyDown "B" -- edit background
on commandKeyDown theKey
if theKey = "?" then goMyHelp -- trap normal help key
else pass commandKeyDown
end commandKeyDown

Related Topics

Placeholders

char

An expression that yields a single character.

For example:

"a"
return
tab
numToChar(13)

statements

Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world" -- built-in command
get total(field 1) -- function call
global HelpInfo -- keyword

HyperTalk Reference

Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Retro View