DEFINE_KEY
Associates executable DECTPU code with a key you specify.
Syntax
DEFINE_KEY ({buffer | learn | program | range | string1},
keyword [,string2 [,string3]])
Parameters
buffer A buffer containing the DECTPU statements to be bound to the
key.
learn A learn sequence containing the DECTPU statements to be
bound to the key.
range A range containing the DECTPU statements to be bound to the
key.
program A program containing the DECTPU statements to be bound to
the key.
string1 A string specifying the DECTPU statements to be bound to the
key.
keyword The key (or key combination) you want to define. See help
on KEYNAMES TABLE and NONDEFINABLE KEYS.
string2 A comment associated with the key definition, which can be
retrieved with the LOOKUP_KEY built-in.
string3 The key map or key-map list in which the key is to be
defined. The default is the first key map in the key-map
list bound to the current buffer.
Examples
1. DEFINE_KEY ("POSITION (main_window)", CTRL_P_KEY);
Defines CTRL/P as the DECTPU statement POSITION (main_window). Note
that you must use quotes around the DECTPU statement.
2. DEFINE_KEY ("COPY_TEXT ('Sincerely,')", KEY_NAME ("s",SHIFT_KEY));
Defines the combination of the DECTPU shift key (by default, PF1) and
the letter S (upper- or lower-case) to copy the text "Sincerely," at
the current character location in the current buffer. Note that you
must alternate the quote characters that are used as delimiters for
the first parameter. Also note that you must quote the keyboard
character that you use in combination with the shift key.
3. user_closing := COMPILE ("Sincerely,");
DEFINE_KEY (user_closing, KEY_NAME ("s",SHIFT_KEY));
Effectively the same as Example 2, but using a variable instead of a
quoted string.
4. DEFINE_KEY (main_buffer, MINUS));
Defines the MINUS key on the keypad to compile the main buffer
(containing DECTPU statements). If there are no errors in the
compilation, DECTPU binds the executable code to that key (or key
combination).
Related topics
LOOKUP_KEY KEY_NAME Keynames Table SHIFT_KEY UNDEFINE_KEY