'
' Simple mouse and cursor key menu
' Written by Colin Birch
' Software written is Wales :-)
'
' V0.2 - Added optional border
' First section - This is where your main program would go
co1 = 0
co2 = 7
' cls screen and call using menu 1
menuno = 1
menu1 = menu
' cls screen and call using menu 2
menuno = 2
menu2 = menu
PRINT "Returns - "; menu1;
" from first menu" PRINT "Returns - "; menu2;
" from second menu"
' **************************************************************************
' Above is where the main program would go
' **************************************************************************
' Actual menu routine starts here
' **************************************************************************
menu1:
' info for menu1
z$(1) = " 1st Option "
z$(2) = " 2nd Option "
z$(3) = " 3rd Option "
z$(4) = " 4th Option "
z$(5) = " 5th Option "
z$(6) = " 6th Option "
z$(7) = " 7th Option "
z$(8) = " 8th Option "
z$(9) = " 9th Option "
z$(10) = "10th Option "
z$(11) = "11th Option "
z$(12) = "12th Option "
z$(13) = "13th Option "
z$(14) = "14th Option "
z$(15) = "15th Option "
' pt = number of menu entries
pt = 15
' mr = right most column for mouse to work.
' usualy the length of longest menu entry
mr = 12
' menu colours
' c1 & c2 non highlighted
' c3 & c4 highlighted
c1 = 0
c2 = 7
c3 = 7
c4 = 0
' px & py screen locations for top left of menu
' px row
' py column
px = 4
py = 3
' border on/off
' pb = 1 border on
' pb = 0 border off
pb = 1
' info for menu 2
z$(1) = "1st Option "
z$(2) = "2nd Option "
z$(3) = "3rd Option - This is a long entry "
z$(4) = "4th Option "
z$(5) = "5th Option "
z$(6) = "6th Option "
' pt = number of menu entries
pt = 6
' mr = right most column for mouse to work.
' usualy length of longest menu entry
mr = 34
' menu colours
' c1 & c2 non highlighted
' c3 & c4 highlighted
c1 = 0
c2 = 7
c3 = 7
c4 = 0
' px & py screen locations for top left of menu
' px row
' py column
px = 6
py = 6
' border on/off
' pb = 1 border on
' pb = 0 border off
pb = 0
' draw the border if needed
pb = 0
py = py + 1
px = px + 1
' Border finished
' Lets display the menu
z1 = 0
reprint:
IF z1
>= (pt
- 1) THEN z1
= pt
- 1
' do the mouse and cursor key inputs
mousein:
' mb2 = _MOUSEBUTTON(2)
' mw = _MOUSEWHEEL
menu = z1 + 1
z1 = my - py
omy = my
' Down Arrow
z1 = z1 + 1
' Up Arrow
z1 = z1 - 1
' Enter key
menu = z1 + 1