Error getting tags :
error 404Error getting tags :
error 404 commandKeyDown | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
commandKeyDown
Basics
Expander triangle
Type
Message
Syntax
commandKeyDown keyName
Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Sent when a Command key combination (Control-key on Unix or Windows) is pressed.
Examples

on commandKeyDown theKey -- make Command-5 go back
if theKey is "5" then go recent card else pass commandKeyDown
end commandKeyDown

Additional Comments
Expander triangle

Handle the commandKeyDown message if you want to provide Command-key or Control-key shortcuts (other than those provided in menus and button accelerators).

Parameters:

The keyName is the actual character of the pressed key.

Comments:

The commandKeyDown message is sent to the active (focused) control, 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 commandKeyDownmessage is sent when the user presses a key while holding down the Command key. On Unix or Windows systems, the commandKeyDownmessage is sent when the user presses the Control key, whether or not another key is pressed at the same time.

User Comments
Expander triangle
User thumbnail
Oliver Kenyon
StarStarStarStarStar
Jan 8, 2010
A common reason for handling the commandKeyDown message is to pre-process text before it is pasted into a field. For example to remove styling from the text before it is input into your application. A good way to do this that allows the closeField and exitField messages to behave as normal is like this:


on commandKeyDown pKey
if pKey is "v" then
set the clipboardData["text"] to the clipboardData["text"]
paste
else
pass commandKeyDown
end if
end commandKeyDown