12-29-2025, 12:00 PM
I've been playing around with my menu. Got this far. Okay, it needs a bit of a tidy up and could be optimised here and there but it works :-)
It uses either the UP/DOWN arrow keys or the mouse. I'm open to comments.
![[Image: menu1.jpg]](https://i.ibb.co/h1gc4vwB/menu1.jpg)
I really don't like the picture attachment on this forum. It always seems to chop the photo :-(
It uses either the UP/DOWN arrow keys or the mouse. I'm open to comments.
Code: (Select All)
'
' My little menu routine
'
' Can be used with up/down arrow keys or mouse
'
' Okay, it could be tidied up quite a lot but it works :-)
'
'
'
Screen 0
Dim z$(20)
defc1 = 0
defc2 = 7
Color defc1, defc2
Cls
' z$(x) holds the info for the menu1
' Option chosen in returned in the variable 'menu'
z$(1) = " Seaward SuperNova (including Plus and Elite) "
z$(2) = " Seaward Primetest "
z$(3) = " Metrel BetaPat / OmegaPAT "
z$(4) = " Robin 5500 "
z$(5) = " MetroTest MPAT 60 / Martindale MicroPat "
z$(6) = " Megger 420 "
z$(7) = " KewTech KT74 (via RS-232) "
z$(8) = " Kewtech KT74 (Via USB) "
z$(9) = " Kewtech KT77 (via RS-232) "
z$(10) = " Kewtech KT77 (via USB) "
z$(11) = " Seaward Europa "
z$(12) = " Seaward Primetest "
z$(13) = " Yet another option "
z$(14) = " Option 14 "
z$(15) = " And finally Cyril "
' pt = number of menu entries
pt = 15
' mr = right most column for mouse to work.
' usualy the length of longest menu entry
mr = 46
' 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
' border colour
c5 = 1
GoSub Menu
Cls
Locate 2, 2
Print "Option "; menu; " chosen"
End
' ******************
' OKAY, Lets do it
' ******************
Menu:
' draw the border if needed
If pb = 1 Then
Color c5, c2
pb = 0
Locate py, px
Print "Õ";
For i = 1 To mr
Print "Í";
Next
Print "¸"
For i = 1 To pt
Locate py + i, px
Print "³"; String$(mr, 32); "³"
Next
Locate py + pt + 1, px
Print "Ô";
For i = 1 To mr
Print "Í";
Next
Print "¾"
py = py + 1
px = px + 1
End If
' Border finished
' Lets display the menu
z1 = 0
reprint:
If z1 <= 0 Then z1 = 0
If z1 >= (pt - 1) Then z1 = pt - 1
Color c1, c2
For i = 1 To pt
Locate py + (i - 1), px
Print z$(i)
Next
Locate py + z1, px
Color c3, c4
Print z$(z1 + 1)
' do the mouse and cursor key inputs
mousein:
Do
Do While _MouseInput ' Check the mouse status
mx = _MouseX
my = _MouseY
mb1 = _MouseButton(1)
' mb2 = _MOUSEBUTTON(2)
' mw = _MOUSEWHEEL
If mb1 = -1 Then
menu = z1 + 1
Color defc1, defc2
Return
End If
If omy <> my Then
If mx >= px And mx < (mr + px) And my >= py And my < pt + py Then
z1 = my - py
omy = my
GoTo reprint
End If
End If
Loop
x$ = InKey$
Loop Until x$ <> ""
lx = Asc(x$)
' Down Arrow
If x$ = Chr$(0) + Chr$(80) Then
z1 = z1 + 1
GoTo reprint
End If
' Up Arrow
If x$ = Chr$(0) + Chr$(72) Then
z1 = z1 - 1
GoTo reprint
End If
' Enter key
If x$ = Chr$(13) Then
menu = z1 + 1
Color defc1, defc2
Return
End If
GoTo mousein
![[Image: menu1.jpg]](https://i.ibb.co/h1gc4vwB/menu1.jpg)
I really don't like the picture attachment on this forum. It always seems to chop the photo :-(
Oh look. A sig line :-)


