ex.hlp (Topic list)
KEY Statement (Assignment) Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the KEY statement to set up one-key equivalents of menu
' selections. For example, pressing F1 is the same as entering the string
' "Add."
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the example code below to the code window
' 3. Press F5 to run the example
 
 CLS                         ' Clear screen
 DIM KeyText$(3)
 DATA Add, Delete, Quit
 FOR I = 1 TO 3              ' Assign soft-key strings from F1 to F3
     READ KeyText$(I)
     KEY I, KeyText$(I) + CHR$(13)
 NEXT I
 PRINT "                 Main Menu": PRINT      ' Print menu
 PRINT "           Add to list (F1)"
 PRINT "           Delete from list (F2)"
 PRINT "           Quit (F3)": PRINT
 DO
     LOCATE 7, 1: PRINT SPACE$(50);             ' Get input and respond
     LOCATE 7, 1: INPUT "             Enter your choice:", R$
     SELECT CASE R$
          CASE "Add", "Delete"
               LOCATE 10, 1: PRINT SPACE$(15);
               LOCATE 10, 1: PRINT R$;
          CASE "Quit"
               EXIT DO
          CASE ELSE
               LOCATE 15, 1: PRINT "Enter first word exactly as shown"
               LOCATE 16, 1: PRINT "or press function key."
     END SELECT
 LOOP