TPUHELP.HLB  —  DEFINE_KEY
  DEFINE_KEY

  Associates executable TPU code with a key you specify.

  Syntax

     DEFINE_KEY ({buffer | learn | program | range | string1},
                keyword [,string2 [,string3]])

  Parameters

     buffer     A buffer containing the TPU statements to be bound to the
                key.

     learn      A learn sequence containing the TPU statements to be
                bound to the key.

     range      A range containing the TPU statements to be bound to the
                key.

     program    A program containing the TPU statements to be bound to
                the key.

     string1    A string specifying the TPU 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 TPU statement POSITION (main_window).  Note
      that you must use quotes around the TPU statement.

  2.  DEFINE_KEY ("COPY_TEXT ('Sincerely,')", KEY_NAME ("s",SHIFT_KEY));

      Defines the combination of the TPU 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 TPU statements).  If there are no errors in the
      compilation, TPU binds the executable code to that key (or key
      combination).

  Related topics

     LOOKUP_KEY   KEY_NAME   Keynames Table   SHIFT_KEY   UNDEFINE_KEY
Close Help