home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
WNDTOOL5.ZIP
/
FULLMENU.SUB
< prev
next >
Wrap
Text File
|
1989-04-26
|
5KB
|
157 lines
'
'$PAGE
'
'******************************************************************************
' Function : *
' *
' Purpose: *
' *
' *
' Results: *
' *
' Usage : *
' *
' *
' Date Written : 01/01/89 - Date Tested: 01/01/89 - Author: James P Morgan *
' Date Modified: - : - : *
'-----------------------------------------------------------------------------*
' NOTE: *
'******************************************************************************
' *
' SUB PROGRAM NAME (PARAMETERS) STATIC/RECURSIVE *
'-----------------------------------------------------------------------------*
' *
'============================================================================
SUB FULLMENU(WIN.TITLE$,MENU$(1),MAIN%,CHOICES%,SELECT.%) STATIC
DEFINT A-Z 'make all short interger by default
MENU.MIN=LBOUND(MENU$) 'adjust for callers "OPTION BASE"
MENU.MAX=UBOUND(MENU$) 'how many choices defined in the array
CALL TITLE(WIN.TITLE$) '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)
ENDIF
IF CHOICES% <5 THEN 'if we have fewer than 5 choices start here
ROW=9
ENDIF
ATTR=&h17 'blue on white
MSG$="Select from the following options:"
CALL FASTPRT(MSG$,ROW,COL,ATTR)
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)
ROW=ROW+2
NEXT
ROW=ROW+2
MSG$="[ESC]"
CALL FASTPRT(MSG$,ROW,COL,ATTR)
ROW=ROW+2
COL=27
ATTR=&h17 'blue on white
ROW=BEGIN+3
'
'
' Display each of the choices
'
I.BASE=1
FOR I=I.BASE TO CHOICES%
MSG$=MENU$((I-I.BASE)+MENU.MIN)
CALL FASTPRT(MSG$,ROW,COL,ATTR)
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"
ENDIF
COL=27
ATTR=&h17 'blue on white
CALL FASTPRT(MSG$,ROW,COL,ATTR)
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
ENDIF
IF LEN(Q$)<>1 THEN 'was an extended function key pressed
GOSUB FULLMENU.SOUNDOFF 'YES, an error
GOTO FULLMENU.CHECK.KEY
ENDIF
IF Q$=CHR$(27) THEN 'ESC aborts this function
SELECT.%=-1 'indicate nothing selected
GOTO FULLMENU.DONE
ENDIF
'
' 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
ENDIF
SELECT.%=VAL(Q$) 'return the value of the key pressed
EXIT SUB
'
FULLMENU.ROW25:
CALL ROW25(MSG$)
IF MSG$="" THEN 'clear line 25 if nothing to display
COLOR 7,1 'white on blue
LOCATE 25,1
PRINT STRING$(79," ");
ENDIF
RETURN
'
FULLMENU.SOUNDOFF:
SOUND 1000,1
SOUND 1500,2
SOUND 500,1
RETURN
'
FULLMENU.DONE:
EXIT SUB
END SUB