Specifies a command that executes when you press a specific key or key combination or click the mouse button.
ON KEY [LABEL KeyLabelName] [Command] |
Parameters
- LABEL KeyLabelName
-
Specifies the key label name assigned to the key. The KeyLabelName is the letter or digit on the key or a special name assigned to the key. The following table lists the special key label names.
Visual FoxPro key label assignments
For this key Specify this KeyLabelName value LEFTARROW
RIGHTARROW
UPARROW
DNARROW
HOME
HOME
END
END
PAGE UP
PGUP
PAGE DOWN
PGDN
DEL
DEL
BACKSPACE
BACKSPACE
SPACEBAR
SPACEBAR
INS
INS
TAB
TAB
SHIFT+TAB
BACKTAB
Left Brace
LBRACE
Right Brace
RBRACE
ENTER
ENTER
F1 to F12
F1, F2, F3 ...
CTRL+F1 to CTRL+F12
CTRL+F1, CTRL+F2 ...
SHIFT+F1 to SHIFT+F12
SHIFT+F1, SHIFT+F2 ...
ALT+F1 to ALT+F12
ALT+F1, ALT+F2, ALT+F3 ...
ALT+0 to ALT+9
ALT+0, ALT+1, ALT+2 ...
ALT+A to ALT+Z
ALT+A, ALT+B, ALT+C ...
CTRL+LEFT ARROW
CTRL+LEFTARROW
CTRL+RIGHT ARROW
CTRL+RIGHTARROW
CTRL+HOME
CTRL+HOME
CTRL+END
CTRL+END
CTRL+PAGE UP
CTRL+PGUP
CTRL+PAGE DOWN
CTRL+PGDN
CTRL+A TO CTRL+Z
CTRL+A, CTRL+B, CTRL+C ...
CTRL+0
CTRL+0
RIGHT MOUSE BUTTON
RIGHTMOUSE
LEFT MOUSE BUTTON
LEFTMOUSE
MOUSE BUTTON
MOUSE
ESC
ESC
- Command
-
Specifies the command that executes when you press the specified key or key combination or click the mouse button.
You can include parameter or parameter expressions with the command that you assign to the key, as in the following example:
Copy Code
ON KEY LABEL ALT+V WAIT WINDOW "Version: " + VERSION()
You can include variables in the assignment, but they must be public. For example:
Copy Code
PUBLIC message message = "Default drive: " + SYS(5) ON KEY LABEL ALT+D WAIT WINDOW message