home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
library
/
qb_pds
/
quicksub
/
mnu.asc
< prev
next >
Wrap
Text File
|
1986-06-12
|
3KB
|
84 lines
' MNU.ASC -- MSDOS QuickBASIC test of the MNULIN.SUB subroutine
' by David L. Poskie Madison, WI 11 June 86
' This demo takes you through using the subroutines, step-by-step
COLOR 14 , 3 , 8 ' Arbitrary - anything you want
' You can alter these dimensions to fit your needs. As it stands,
' MNULIN will handle up to 11 menus with 9 selections per menu.
DIM MENU$(10 , 10) , NUM.SEL(10)
MENU.DAT:
' Menu DATA begins -- replace with your own menu data.
' The prompt comes first,
' then menu selections,
' then terminator/s: ` * ' = end of that menu
' ` $ ' = end of all menus.
' Once you understand the format, there is no need for spaces
' in the DATA lines.
' Prompt Selections Terms
DATA PROMPT ,Sel A,Sel B,Sel C,Sel D,None ,*
DATA Ingredient ,Parsley,Sage,Rosemary,Thyme,Done ,*
DATA Your Preference ,Life,Liberty,Pursuit of Happiness,EXIT ,*
DATA Ready ,BIG <>,BIGGER <<>>,THE BIGGEST <<<>>>,QUIT ,*
DATA Aim ,EEENY,MEENY,MINEY,MOE,GO ,*
DATA Fire ,One,Two,Three,Four,Five,Six,Seven,Eight,END ,* ,$
'____________________END OF DATA______________________
GOSUB LOAD.MNU ' Load all menus
SET.MENU:
CLS
LOCATE 12 , 25
PRINT "MNULIN Line Menu Demonstration"
LOCATE 25 , 19
PRINT "Select Menu 0 -"; MAX.MNU; "(anything else quits)";
GOSUB GETKEY.CLEAR ' Get a key
MNU = K.CODE - 48 ' Convert to the actual menu number
IF MNU > MAX.MNU _
OR MNU < 0 _
THEN GOTO QUIT ' Quit if out of bounds
CLS
GET.SEL.NUM:
LOCATE 12 , 35
PRINT "Select One"
LOCATE 25,1 ' Locate the start of the menu line
GOSUB MNULIN ' Do the menu line
' The ONLY check the subroutine does is to convert Quit to -21. All other
' evaluation of K.CODE. or Q$ must be made in this calling program.
IF K.CODE = -21 _
THEN GOTO SET.MENU ' Quit will ALWAYS be -21
LOCATE 12 , 34 ' Evaluate the menu selection
PRINT "You pressed"; K.CODE
DLY = 2 ' Hold for 2 seconds
GOSUB DELAY
LOCATE 12 , 34
PRINT SPC(16)
GOTO GET.SEL.NUM ' Return for further demonstration
QUIT:
COLOR 14 , 3 , 8 ' Set to your normal screen colors
CLS
SYSTEM
REM $INCLUDE: 'MNULIN.SUB'
REM $INCLUDE: 'GETKEY.SUB'
REM $INCLUDE: 'DELAY.SUB'
' >>>> Physical EOF MNU.ASC