The on KEYDOWN and on KEYUP events trigger when a user presses or releases a key in a custom window.
Format: on <level>:KEYDOWN:<@>:<key,...,keyN>:<commands>
Example: on 1:KEYDOWN:@:*:echo User pressed key $keyval in $active
on 1:KEYDOWN:@frog:32:echo user pressed space bar in @frog
This triggers when a user presses the space bar key in window @frog.
on 1:KEYDOWN:@:37,38,39,40:echo pressed cursor key $keyval $keyrpt
This triggers when a user presses any of the cursor keys in any window.
$keyval returns the key code of the key being pressed.
$keychar returns the actual letter of the key being pressed.
$keyrpt returns $true if the key is repeating due to a user holding down the key.