home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / QBMENU2.ZIP / MENU2.BAS < prev   
Encoding:
BASIC Source File  |  1989-12-17  |  2.6 KB  |  128 lines

  1. DEFINT A-Z
  2.  
  3. ' QB Menu routine based on Steven E. Skindell's routine
  4. '
  5. ' Stephen C. Lenz
  6. ' 380 Morris Avenue
  7. ' Providence, RI 02906
  8. ' CIS 72431,3147
  9.  
  10. MaxNum = 13
  11.  
  12. DIM CAP$(1 TO MaxNum), ID$(1 TO MaxNum), ID(1 TO MaxNum)
  13.  
  14.    FOR X = 1 TO MaxNum
  15.       READ ID$(X), ID(X)
  16.       FL$ = FL$ + MID$(ID$(X), 2, 1)
  17.       CAP$(X) = " " + MID$(ID$(X), 2, 1)
  18.    NEXT
  19.  
  20.    Reference = 1                 'Starting Point of numbered command
  21.    LineNumber = 25               'Y Axis start line
  22.  
  23. StartHere:
  24.    CLS
  25.   
  26.    LOCATE 10, 1
  27.    PRINT "Use the right/left arrow keys to move the cursor bar then press ENTER -or-"
  28.    PRINT "press the Highlighted letter next to the command to execute."
  29.    PRINT "Press 'q' to Quit ..."
  30.   
  31.    GOSUB GetMenu
  32.   
  33.    CLS
  34.   
  35.    IF Reference = LEN(FL$) THEN CLS : PRINT "Done!": BEEP: END
  36.   
  37.    COLOR 7, 0
  38.    PRINT "You selected : ";
  39.   
  40.    COLOR 15, 0
  41.    PRINT MID$(FL$, Reference, 1); "  ("; Reference; ")"
  42.    PRINT
  43.    PRINT
  44.   
  45.    COLOR 7, 0
  46.    LINE INPUT "Press Enter..."; bb$
  47.   
  48.    GOTO StartHere  'notice the previous command is highlighted (reverse video)
  49.  
  50. GetMenu:
  51.    IF Reference > MaxNum THEN
  52.       Reference = 1
  53.    ELSEIF Reference < 1 THEN
  54.       Reference = MaxNum
  55.    END IF
  56.   
  57.    GOSUB MainMenu
  58.   
  59.    GOSUB GetMenu2
  60.   
  61.    RETURN
  62.  
  63. GetMenu2:
  64.    DO
  65.       Aj$ = INKEY$
  66.    LOOP WHILE Aj$ = ""
  67.   
  68.    IF Aj$ = CHR$(27) THEN CLS : END
  69.  
  70.    IF Aj$ = CHR$(13) THEN RETURN
  71.  
  72.    Aj$ = UCASE$(Aj$)
  73.   
  74.    IF INSTR(FL$, Aj$) > 0 THEN
  75.       Reference = INSTR(FL$, Aj$)  'starting letter of command
  76.       GOSUB GetMenub
  77.       RETURN
  78.    END IF
  79.   
  80. DoAgin:
  81.    IF (LEN(Aj$) = 2 AND RIGHT$(Aj$, 1) = CHR$(15)) OR (LEN(Aj$) = 2 AND RIGHT$(Aj$, 1) = CHR$(75)) THEN
  82.       Reference = Reference - 1
  83.       GOTO GetMenu
  84.    ELSEIF (Aj$ = CHR$(9)) OR (RIGHT$(Aj$, 1) = CHR$(77) AND LEN(Aj$) = 2) THEN
  85.       Reference = Reference + 1
  86.       GOTO GetMenu
  87.    END IF
  88.   
  89.    GOTO GetMenu2
  90.  
  91. GetMenub:
  92.    IF Reference > MaxNum THEN
  93.       Reference = 1
  94.    END IF
  95.   
  96.    IF Reference < 1 THEN
  97.       Reference = MaxNum
  98.    END IF
  99.   
  100.    GOSUB MainMenu
  101.  
  102. RETURN
  103.  
  104. MainMenu:
  105.   
  106.    FOR X = 1 TO MaxNum
  107.       LOCATE LineNumber, ID(X)
  108.       COLOR 7, 0
  109.       PRINT ID$(X);
  110.       LOCATE LineNumber, ID(X)
  111.       COLOR 14, 0
  112.       PRINT CAP$(X);
  113.    NEXT
  114.  
  115.    COLOR 0, 15
  116.   
  117.    LOCATE LineNumber, ID(Reference)
  118.    PRINT ID$(Reference);
  119.   
  120.    COLOR 7, 0
  121.  
  122. RETURN
  123.  
  124. DATA " Add ",2," Browse ",7," Calc ",15," Delete ",21
  125. DATA " Edit ",29," Find ",35," Keys ",41," Next ",47
  126. DATA " Opt ",53," Prev ",58," Rep ",64," Save ",69," Quit ",75
  127.  
  128.