home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / quicksub / mnu.asc < prev    next >
Text File  |  1986-06-12  |  3KB  |  84 lines

  1. ' MNU.ASC -- MSDOS QuickBASIC test of the MNULIN.SUB subroutine
  2. '         by David L. Poskie   Madison, WI    11 June 86
  3.     
  4. '      This demo takes you through using the subroutines, step-by-step
  5.  
  6.     COLOR 14 , 3 , 8        ' Arbitrary - anything you want
  7.  
  8.     ' You can alter these dimensions to fit your needs. As it stands,
  9.     '  MNULIN will handle up to 11 menus with 9 selections per menu.
  10.     DIM MENU$(10 , 10) , NUM.SEL(10) 
  11.  
  12. MENU.DAT:        
  13.     ' Menu DATA begins -- replace with your own menu data.
  14.     ' The prompt comes first,
  15.     '     then menu selections,
  16.     '       then terminator/s:    ` * ' = end of that menu 
  17.     '                ` $ ' = end of all menus.
  18.     ' Once you understand the format, there is no need for spaces
  19.     '   in the DATA lines.
  20.  
  21.         '  Prompt           Selections                                  Terms
  22.       DATA PROMPT          ,Sel A,Sel B,Sel C,Sel D,None                 ,*
  23.       DATA Ingredient      ,Parsley,Sage,Rosemary,Thyme,Done             ,*
  24.       DATA Your Preference ,Life,Liberty,Pursuit of Happiness,EXIT       ,*
  25.       DATA Ready           ,BIG <>,BIGGER <<>>,THE BIGGEST <<<>>>,QUIT   ,*
  26.       DATA Aim             ,EEENY,MEENY,MINEY,MOE,GO                     ,*
  27.       DATA Fire            ,One,Two,Three,Four,Five,Six,Seven,Eight,END  ,* ,$
  28.  
  29.     '____________________END OF DATA______________________
  30.  
  31.     GOSUB LOAD.MNU            ' Load all menus
  32.  
  33. SET.MENU:
  34.     CLS
  35.     LOCATE 12 , 25
  36.     PRINT "MNULIN Line Menu Demonstration"
  37.  
  38.     LOCATE 25 , 19
  39.     PRINT "Select Menu 0 -"; MAX.MNU; "(anything else quits)";
  40.  
  41.     GOSUB GETKEY.CLEAR        ' Get a key
  42.     MNU = K.CODE - 48        ' Convert to the actual menu number
  43.  
  44.     IF MNU > MAX.MNU                        _
  45.        OR MNU < 0                            _
  46.           THEN GOTO QUIT        ' Quit if out of bounds    
  47.  
  48.     CLS
  49.  
  50. GET.SEL.NUM:
  51.     LOCATE 12 , 35
  52.     PRINT "Select One"
  53.  
  54.     LOCATE 25,1            ' Locate the start of the menu line
  55.     GOSUB MNULIN            ' Do the menu line 
  56.  
  57.   ' The ONLY check the subroutine does is to convert Quit to -21. All other
  58.   ' evaluation of K.CODE. or Q$ must be made in this calling program.
  59.  
  60.     IF K.CODE = -21                            _
  61.        THEN GOTO SET.MENU        ' Quit will ALWAYS be -21
  62.  
  63.     LOCATE 12 , 34            ' Evaluate the menu selection
  64.     PRINT "You pressed"; K.CODE
  65.  
  66.     DLY = 2                ' Hold for 2 seconds 
  67.     GOSUB DELAY
  68.  
  69.     LOCATE 12 , 34
  70.     PRINT SPC(16)
  71.  
  72. GOTO GET.SEL.NUM            ' Return for further demonstration
  73.  
  74. QUIT:
  75.     COLOR 14 , 3 , 8        ' Set to your normal screen colors
  76.     CLS
  77.     SYSTEM
  78.  
  79.     REM    $INCLUDE: 'MNULIN.SUB'
  80.     REM    $INCLUDE: 'GETKEY.SUB'
  81.     REM    $INCLUDE: 'DELAY.SUB'
  82.  
  83. ' >>>> Physical EOF MNU.ASC
  84.