home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / sri314_b.zip / DEMOPRGS.ZIP / MENU.PRG < prev    next >
Text File  |  1990-09-30  |  3KB  |  88 lines

  1. ***************************************************************************
  2. **  MENU.PRG
  3. **  (C) Copyright 1990, Sub Rosa Publishing Inc.
  4. **  A demonstration program provided to SR-Info and VP-Info users.
  5. **  This program may be copied freely. If it is used in commercial code,
  6. **  please credit the source, Sub Rosa Publishing Inc.
  7. **
  8. **  MENU demonstrates the use of the MENU() function along with a variety
  9. **  of Info commands and functions.
  10. **  Menu is compatible with all current versions of SR-Info and VP-Info.
  11. **
  12. **  MENU displays a menu, determines the choice made, and takes
  13. **  action depending both on the selection and the key used to make
  14. **  the selection.
  15. **
  16. **  Bernie Melman
  17. **
  18. ***************************************************************************
  19. IF :color <> 7
  20.    SET color to 31; white on blue
  21. ENDIF
  22. SET WIDTH to 80
  23. COLOR :color,0,0,24,79,177    ;fill screen with pattern
  24. * 177 is a fill character.
  25. COLOR 112,7,20,21,66          ;draw black box to become shadow
  26. WINDOW 6,18,19,62 DOUBLE COLOR :color   ;declare space for menu text
  27. ON escape
  28.    CURSOR 22,0
  29.    WINDOW
  30.    CANCEL
  31. ENDON
  32. DO WHILE t                    ;put main menu in an infinite loop
  33.    ERASE                      ;fills window with blanks
  34.    TEXT
  35.  
  36.              DEMO MAIN MENU
  37.  
  38.     0. Exit program and SR-Info.
  39.  
  40.     1. Branch 1 of sample program.
  41.     2. Do not choose this option.
  42.     3. Branch 3 - choose with function key.
  43.     4. Do not choose this option.
  44.     5. Run the demo program EDBROW.
  45.     6. Exit program - stay in SR-Info.
  46.  
  47.    ENDTEXT
  48.    CURSOR 12,25 ; positions menu cursor over 1st character of 1st choice
  49.    selection=menu(6,37)      ;six choices menu bar width 37
  50.    DO CASE
  51.    CASE selection=0 .or. :key=327  ; <home> key
  52.       QUIT
  53.    CASE selection=1
  54.       IF :key = 13
  55.          @ 20,21 say " CHOSEN WITH ENTER KEY! Press any key. "
  56.       ELSE
  57.          IF :key < 255
  58.             @ 20,21 say " CHOSEN WITH KEY "+chr(:key)+"  Press any key. "
  59.          ELSE
  60.             @ 20,21 say " KEY WITH Info code "+str(:key,3)+" Press any key. "
  61.          ENDIF
  62.       ENDIF
  63.       dummy=inkey()         ;wait for keystroke
  64.       @ 20,21 say blank(40,205)
  65.    CASE selection=3
  66.       IF (:key < 315) .or. (:key > 324)
  67.          @ 20,21 say " NOT A Function KEY! Press any key. "
  68.       ELSE
  69.          @ 20,21 say " CHOSEN WITH F"+str(:key-314,2)+". Press any key. "
  70.       ENDIF
  71.       DUMMY = inkey()
  72.       @ 20,21 say blank(40,205)
  73.    CASE selection=5
  74.       chain EDBROW
  75.    CASE selection=6
  76.       WINDOW                  ;reset window to full screen
  77.       ERASE                   ;clear screen
  78.       CURSOR 0,0; cursor to top left
  79.       CANCEL
  80.    OTHERWISE
  81.       @ 20,21 say " ILLEGAL CHOICE! Press any key. "
  82.       DUMMY = inkey()
  83.       @ 20,21 say blank(40,205)  ;205 rebuilds double box
  84.    ENDCASE
  85. ENDDO
  86. *
  87. *                         *** end of MENU.PRG ***
  88.