12-03-2004, 07:39 AM
i guess. but it's nice for limited line compo's.
Also found something else when trying to compile a menu program i got from qbnz:
I got this error:
free.bas(9) : error 11: Expected constant, found: ')'
to me the syntax looks legal.
Also found something else when trying to compile a menu program i got from qbnz:
Code:
DECLARE SUB menu (numberofchoices, title$, menuchoices$(), choice)
CLS
title$ = "title"
numofchoices = 3 'number of choices in your menu (1 to numofchoices)
DIM menuchoices(numofchoices) AS STRING
'your menu choices as text:
menuchoices(1) = "first choice"
menuchoices(2) = "choice..."
menuchoices(3) = "exit"
CALL menu(numbofchoices, title$, menuchoices$(), choice)
ERASE menuchoices 'makes the array inexistant
' choice is the selection now you can use : select case or other code
SELECT CASE choice
CASE 1
PRINT "1.first choice"
CASE 2
PRINT "2..."
CASE 3
PRINT "bye"
END SELECT
SUB menu (numofchoices, title$, menuchoices$(), choice)
CLS
choice = 1 'initialize the choice
'menu format:
distancefromtoptomenu = INT((27 - numofchoices) / 3)
'menu title
LOCATE 2, (41 - LEN(title$) / 2): PRINT title$
DO
RESTORE '38 - LEN(MENUCHOICES(numofchoices)) / 2
FOR n = 1 TO numofchoices
LOCATE n + distancefromtoptomenu, 34: PRINT n; ") "; menuchoices$(n)
IF n = choice THEN LOCATE n + distancefromtoptomenu, 33: PRINT ">"
IF n = pchoice AND pchoice <> choice THEN LOCATE n + distancefromtoptomenu, 33: PRINT " "
NEXT
k$ = ""
DO
k$ = INKEY$
vakey = VAL(k$)
k$ = UCASE$(k$)
LOOP UNTIL k$ <> ""
pchoice = choice ' save the past choice
IF k$ = (CHR$(0) + "P") AND numofchoices >= choice THEN choice = choice + 1
IF k$ = (CHR$(0) + "H") AND 1 <= choice THEN choice = choice - 1
IF k$ = (CHR$(0) + "P") AND numofchoices < choice THEN choice = 1
IF k$ = (CHR$(0) + "H") AND 1 > choice THEN choice = numofchoices
IF VAL(k$) = vakey AND vakey <= numofchoices AND vakey >= 1 THEN pchoice = choice: choice = VAL(k$)
IF k$ = CHR$(13) THEN EXIT DO
IF k$ = CHR$(27) THEN choice = 0: k$ = "": EXIT DO
LOOP
END SUB
I got this error:
free.bas(9) : error 11: Expected constant, found: ')'
to me the syntax looks legal.
Jumping Jahoolipers!