home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / optmen.zip / OPTDEMO.PRG < prev    next >
Text File  |  1987-02-22  |  2KB  |  81 lines

  1. *
  2. *
  3. * OPTDemo - Demo programs for use of opt menu procedure
  4. *
  5. * by Anthony T. DeHart - GENIE (ATDEHART)
  6.  
  7. ***** Setup Program States
  8.  
  9. set talk off
  10. set echo off
  11. set status off
  12. set scoreboard off
  13. set bell off
  14. set exact off
  15. set confirm on
  16. set deleted on
  17.  
  18. ***** Global Arrays for menu choices and Last menu selection for a menu level
  19.  
  20. declare choice[9]
  21. declare wOldSel[9]
  22.  
  23. ***** Setup variables
  24.  
  25. wlevel = 1  && First menu level
  26.  
  27. do OptSetup  && Other variable setups
  28.  
  29. selection = 0
  30. clr = .T.  && Clear Screen Flag
  31.  
  32. do while .T.  && Menu Loop
  33.    if clr
  34.       Title = 'Main Access Menu' && Clear Screen and place title at top
  35.       do lscrtop with Title
  36.       clr = .F.
  37.    endif
  38.  
  39. ***** Setup Menu selections for Main Menu
  40.  
  41.    choice[1] = 'Mailing List Maintenance'
  42.    choice[2] = 'Print Reports'
  43.    choice[3] = 'Reindex Files'
  44.    choice[9] = 'Exit Option Menu Demo'  && 9 is always exit
  45.  
  46.    do opt with choice, 3, wOldSel[wlevel], selection  && Do menu selection
  47.  
  48.       wOldSel[wlevel] = selection  && Last selection always stored in array
  49.  
  50. ***** Do appropriate action for menu selection
  51.  
  52.       do case
  53.          case selection = 1
  54.           do MailMenu && Another demo menu
  55.           clr = .T. && Clear screen upon return
  56.      case selection = 2
  57.           do RepMenu && Another demo menu
  58.           clr = .T. && Clear screen upon return
  59.      case selection = 3
  60.           do OPTNDX && Fake program (doesn't do anything)
  61.           clr = .F. && Don't clear screen (was restored from a save screen)
  62.      case selection = 9  && QUIT
  63.           Question = "Are you sure you want to quit"
  64.           Answer = ""
  65.           do Ask_YN with Question, Answer  && Ask if sure in pop up window
  66.           if (Answer $ 'Yy')
  67.          exit  && Yes, then exit else do menu again
  68.           endif
  69.           clr = .F.  && Don't clear screen
  70.       endcase
  71. enddo (end of optdemo)
  72.  
  73. ***** Done so clear screen and quit out of program
  74.  
  75. clear
  76. ? 'Normal Exit from '+stitle
  77. ?
  78. ?
  79. return
  80.  
  81.