Page 1 of 1

-

Posted: Fri Mar 14, 2003 10:52 pm
by Thunderhawk66
-

Re: QBasic 4.5 Scrollable Menus

Posted: Sat Mar 15, 2003 4:07 am
by Baz
Hi.

Here is a simple solution, if it works for you .
this just scrolls 20 menu items in a 5 line area.
Use , . keys to move up or down.

I have not included any means to select a menu item at this time incase this sample does not suit your needs.



REM menu
DIM m$(20)
CLS
m$(1) = "Sample Menu1"
m$(2) = "Sample Menu2"
m$(3) = "Sample Menu3"
m$(4) = "Sample Menu4"
m$(5) = "Sample Menu5"
m$(6) = "Sample Menu6"
m$(7) = "Sample Menu7"
m$(8) = "Sample Menu8"
m$(9) = "Sample Menu9"
m$(10) = "Sample Menu10"
m$(11) = "Sample Menu11"
m$(12) = "Sample Menu12"
m$(13) = "Sample Menu13"
m$(14) = "Sample Menu14"
m$(15) = "Sample Menu15"
m$(16) = "Sample Menu16"
m$(17) = "Sample Menu17"
m$(18) = "Sample Menu18"
m$(19) = "Sample Menu19"
m$(20) = "Sample Menu20"



DO
k$ = ""
k$ = INKEY$
IF k$ = "," AND q > 1 THEN q = q - 1: GOSUB menu
IF k$ = "." AND q < 16 THEN q = q + 1: GOSUB menu
LOOP UNTIL k$ = CHR$(27)
END

menu:

IF q > 0 AND q < 16 THEN
z = 0
FOR y = q TO q + 5
LOCATE 5 + z, 10: PRINT " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"
LOCATE 5 + z, 10: PRINT m$(y)
z = z + 1
NEXT
END IF
RETURN