| .KEY Statement Programming Example. |
|
  QuickSCREEN       Details      Example       Contents       Index |
| ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ |
| KEY Statement Programming Example |
|   |
| These examples show how to assign values to soft keys. |
|   |
| Here is an example of assigning and disabling a soft key. KEY LIST |
| displays key values after KEY 4 has been assigned and again after |
| it has been disabled: |
|   |
| CLS                       ' Clear screen |
| KEY 4, "MENU" + CHR$(13)  'Assigns to soft key 4 the string |
|                           '"MENU" followed by a carriage return. |
| KEY LIST |
| KEY 4, ""                 'Disables soft key 4. |
| KEY LIST |
|   |
| Here is an example of using KEY statements to set up one-key |
| equivalents of menu selections. For example, pressing F1 |
| is the same as entering the string "Add": |
|   |
| CLS                       ' Clear screen |
| DIM KeyText$(3) |
| DATA Add, Delete, Quit |
| ' Assign soft-key strings to F1 to F3. |
| FOR I = 1 TO 3 |
|    READ KeyText$(I) |
|    KEY I, KeyText$(I) + CHR$(13) |
| NEXT I |
| ' Print menu. |
| PRINT "                 Main Menu" : PRINT |
| PRINT "           Add to list (F1)" |
| PRINT "           Delete from list (F2)" |
| PRINT "           Quit (F3)" : PRINT |
| ' Get input and respond. |
| DO |
|    LOCATE 7,1 : PRINT SPACE$(50); |
|    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 10,1 : PRINT "Enter first word or press key." |
|    END SELECT |
| LOOP |
|   |