Bind keymap:Keymap key:Str := action:Any...
Assign keys. This command arranges that action is invoked when the key is pressed while keymap is active. keymap is an identifier or ByName() expression. The key is a string specifying the key, the action is either a string containing a command, or a numeric atom (see Atom, Key).
For example,
Bind PlanetScreen "a" := "AutoBuild"
makes the A key on the planet screen run the AutoBuild command. New key definitions override old definitions.
You can define multiple keys in the same keymap in one line, by simply writing multiple assignments separated by commas.
In PCC2 Web, keystrokes consist of zero or more modifiers (Ctrl-, Alt-, Shift-, Meta-, Input-, possibly abbreviated to C-, A-, etc.), followed by a key name. A key name is either a printable character, or a special key name: F1 to F12, bs (backspace), Del, Down, End, Enter, ESC, Home, Ins, Left, LWin, Menu, PgDn, PgUp, Right, RWin, Tab, Up.
Modifiers can be followed by a "?" to mark them optional. The Input modifier defines whether a keystroke is accepted while the cursor is within a text input field. Use this to decide when a browser shall handle the key natively.
Examples:
- "C-F1" (Ctrl+F1, only valid if cursor is not in input field);
- "C?-F1" (Ctrl+F1 or F1, only valid if cursor is not in input field);
- "C-I-F1" (Ctrl+F1, only valid if cursor is in input field);
- "C-I?-F1" (Ctrl+F1, valid both inside and outside input field).
To undefine a key, bind it to the empty string. Keymaps do not survive PCC Web exiting and re-loading.
See also: Elementary Commands