Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My little menu
#1
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.

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]

I really don't like the picture attachment on this forum. It always seems to chop the photo :-(
Oh look. A sig line :-)
Reply


Messages In This Thread
My little menu - by Mad Axeman - 12-29-2025, 12:00 PM
RE: My little menu - by bplus - 12-29-2025, 02:09 PM
RE: My little menu - by Mad Axeman - 12-29-2025, 02:28 PM
RE: My little menu - by bplus - 12-29-2025, 02:32 PM
RE: My little menu - by Mad Axeman - 12-29-2025, 02:51 PM
RE: My little menu - by Petr - 12-29-2025, 03:45 PM
RE: My little menu - by Mad Axeman - 12-29-2025, 04:03 PM
RE: My little menu - by bplus - 12-29-2025, 07:08 PM
RE: My little menu - by Mad Axeman - 12-29-2025, 10:13 PM
RE: My little menu - by NakedApe - 12-30-2025, 01:58 AM
RE: My little menu - by Unseen Machine - 12-30-2025, 02:37 AM
RE: My little menu - by Pete - 12-30-2025, 02:48 AM
RE: My little menu - by Unseen Machine - 12-30-2025, 03:04 AM
RE: My little menu - by Rudy M - 12-30-2025, 09:47 AM
RE: My little menu - by bplus - 12-30-2025, 03:18 PM
RE: My little menu - by Pete - 12-30-2025, 06:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Menu Demo to be Expanded Pete 29 1,687 01-31-2026, 11:08 PM
Last Post: Pete
  Hardware Popup Menu. Yes, Dragable! Pete 2 704 04-03-2025, 12:15 AM
Last Post: Pete
  Text Menu Library Project Pete 3 748 01-03-2025, 05:55 PM
Last Post: Pete
  EVMS -- Easy Versatile Menu System SMcNeill 8 1,759 11-30-2022, 06:15 AM
Last Post: SMcNeill
  a simple menu system (works) madscijr 0 651 07-28-2022, 11:07 PM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)