bas7advr.hlp (Topic list)
KEY Statements (Assignment) Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
KEY assigns and lists soft-key values.
 
KEY n%, stringexpression$
KEY ON
KEY OFF
KEY LIST
    ■ KEY n%, stringexpression$ assigns soft-key string values. The
      argument n% is a number that represents the function key. The values
      for n% are 1 to 10 for the function keys, and 30 and 31 for function
      keys F11 and F12 on 101-key keyboards. The argument stringexpr$ is a
      string of up to 15 characters that is returned when the function key
      is pressed. If the string is longer than 15 characters, the extra
      characters are ignored.
 
Usage Notes
    ■ The KEY statement allows you to designate special "soft-key"
      functions--strings that are returned when function keys are pressed.
    ■ Assigning a null string to a soft key disables the function key as
      a soft key.
    ■ If the function key number is not in the correct range, BASIC
      generates the error message, "Illegal function call," and the
      previous key string expression is retained.
    ■ You may display soft keys with the KEY ON, KEY OFF, and KEY LIST
      statements:
 
        Statement      Action
        KEY ON         Displays the first five to six characters of the
                       soft-key string values on the bottom line of the
                       screen.
        KEY OFF        Erases the soft-key display from the bottom line,
                       making that line available for program use. It does
                       not disable the function keys.
        KEY LIST       Displays all soft-key values on the screen, with all
                       15 characters of each key displayed.
 
    ■ If a soft key is pressed, the effect is the same as if the user typed
      the string associated with the soft key.
    ■ INPUT$, INPUT, and INKEY$ all can be used to read the string produced
      by pressing the soft key.