home *** CD-ROM | disk | FTP | other *** search
- ' $dynamic
-
- defint a-z
-
- ' sample program
-
- dim menudata$(3)
-
- menudata$(0) = "Go"
- menudata$(1) = "Previous"
- menudata$(2) = "Next"
- menudata$(3) = "Quit"
- color 15,1,1
- cls
- call barmenu (25,5,10,14,1,menudata$(),option$)
- cls
- print option$;
- end
-
- ' meat of routine
-
- sub barmenu (y,x,spacing,tc,bc,prompts$(1),return$) static
-
- top = lbound(prompts$)
- bottom = ubound(prompts$)
- redim position(bottom)
- okprompt$ = ""
- locate y,x,0
- color tc,bc
- for i = top to bottom
- position (i) = pos(y)
- print prompts$(i); spc(spacing);
- okprompt$ = okprompt$ + chr$(asc(prompts$(i)))
- next i
- current = top
- moveto = current
- return$ = ""
- while return$ = ""
- color bc,tc
- locate y,position(current)
- print prompts$(current);
- while ch$ = ""
- ch$ = inkey$
- wend
- if asc(ch$) = 0 then
- call specialkey(ch$,moveto,top,bottom)
- elseif ch$ = chr$(13) then
- return$ = chr$(asc(prompts$(current)))
- elseif instr(okprompt$,ch$) > 0 then
- return$ = ch$
- else
- beep
- end if
- if moveto <> current then
- color tc,bc
- locate y,position(current)
- print prompts$(current);
- current = moveto
- end if
- ch$ = ""
- wend
- erase position
- end sub
-
- sub specialkey(ch$,where,low,high) static
-
- c = asc(right$(ch$,1))
- if c = 71 then
- where = low
- elseif c = 79 then
- where = high
- elseif c = 75 then
- where = where -1
- elseif c = 77 then
- where = where + 1
- else
- beep
- end if
- if where < low then where = high
- if where > high then where = low
- end sub
-