home *** CD-ROM | disk | FTP | other *** search
- '
- '
- '******************************************************************************
- ' Function : FULLMENU *
- ' *
- ' Purpose: *
- ' *
- ' *
- ' Results: *
- ' *
- ' Usage : *
- ' *
- ' *
- ' Date Written : 09/01/90 - Date Tested: 09/01/90 - Author: James P Morgan *
- ' Date Modified: - : - : *
- '-----------------------------------------------------------------------------*
- ' NOTE: *
- '******************************************************************************
- ' *
- ' SUB PROGRAM NAME (PARAMETERS) STATIC/RECURSIVE *
- '-----------------------------------------------------------------------------*
- ' *
- SUB FULLMENU(WIN.TITLE$,MENU$(1),MAIN%,CHOICES%,SELECT.%,RETURN.CODE%) STATIC
-
- DEFINT A-Z 'make all short interger by default
-
- RETURN.CODE%=0
- VIDEO.RETURN.CODE%=0
- TITLE.RETURN.CODE=0
- ROW25.RETURN.CODE=0
-
- MENU.MIN=LBOUND(MENU$) 'adjust for callers "OPTION BASE"
- MENU.MAX=UBOUND(MENU$) 'how many choices defined in the array
-
- MENU.BASE=1-MENU.MIN
-
- CALL TITLE(WIN.TITLE$,TITLE.RETURN.CODE%) 'display the menu title
-
- SELECT.%=0 'assume nothing selected
-
- ROW=8 'this is where the selection list starts
- COL=10
-
- IF CHOICES%>(MENU.MAX+(1-MENU.MIN)) THEN 'cant be more choices then items in the array
- CHOICES%=MENU.MAX+(1-MENU.MIN)
- END IF
-
- IF CHOICES% <5 THEN 'if we have fewer than 5 choices start here
- ROW=9
- END IF
-
- ATTR=&h17 'blue on white
- MSG$="Select from the following options:"
- CALL FASTPRT(MSG$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
-
- COL=20
- ATTR=&h70 'black on white
- BEGIN=ROW
- ROW=ROW+3
-
-
- '
- '
- ' Display a number for each of the choices
- '
- FOR I=1 TO CHOICES%
- MSG$="[ "+RIGHT$(STR$(I),1)+" ]"
- CALL FASTPRT(MSG$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
- ROW=ROW+2
- NEXT
-
- ROW=ROW+2
- MSG$="[ESC]"
- CALL FASTPRT(MSG$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
-
- ROW=ROW+2
- COL=27
- ATTR=&h17 'blue on white
- ROW=BEGIN+3
-
- '
- ' Display each of the choices
- '
- FOR I=MENU.MIN TO MENU.MIN+CHOICES%
- MSG$=MENU$(I)
- CALL FASTPRT(MSG$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
- ROW=ROW+2
- NEXT
-
- ROW=ROW+2
-
- '
- ' Is this the main menu, being displayed
- '
- IF MAIN%=0 THEN
- MSG$="Return to previous menu."
- ELSE
- MSG$="Exit Program"
- END IF
-
- COL=27
- ATTR=&h17 'blue on white
- CALL FASTPRT(MSG$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
-
- COLOR 7,1 'white on blue
-
- MSG$="Select desired option by pressing the appropriate key"
-
- GOSUB FULLMENU.ROW25 'display on line 25
-
- '
- FULLMENU.CHECK.KEY:
- Q$=INKEY$
- IF Q$="" THEN 'wait until a key pressed
- GOTO FULLMENU.CHECK.KEY
- END IF
-
- IF LEN(Q$)<>1 THEN 'was an extended function key pressed
- GOSUB FULLMENU.SOUNDOFF 'YES, an error
- GOTO FULLMENU.CHECK.KEY
- END IF
-
- IF Q$=CHR$(27) THEN 'ESC aborts this function
- SELECT.%=-1 'indicate nothing selected
- RETURN.CODE=-1
- GOTO FULLMENU.DONE
- END IF
-
- '
- ' was a key in the range of options pressed
- '
- IF Q$<"1" OR Q$>RIGHT$(STR$(CHOICES%),1) THEN
- GOSUB FULLMENU.SOUNDOFF 'invalid key pressed
- GOTO FULLMENU.CHECK.KEY
- END IF
-
- SELECT.%=VAL(Q$) 'return the value of the key pressed
- GOTO FULLMENU.DONE
-
- '
- FULLMENU.ROW25:
- CALL ROW25(MSG$,ROW25.RETURN.CODE%)
-
- IF MSG$="" THEN 'clear line 25 if nothing to display
- COLOR 7,1 'white on blue
- LOCATE 25,1
- PRINT STRING$(79," ");
- END IF
-
- RETURN
-
- '
- FULLMENU.SOUNDOFF:
- SOUND 1000,1
- SOUND 1500,2
- SOUND 500,1
- RETURN
-
- '
- FULLMENU.DONE:
- MSG$=""
- END SUB