Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a menu function?
#8
I will try something from primitive Sound command a one-liner with no need for assets.

Update:
Code: (Select All)
While _KeyDown(27) = 0
    'test click
    Sound 2000, .015
    _Delay .8
Wend

Yeah kinda works:
Code: (Select All)
_Title "Quick Menu" ' b+ 2024-12-20
Screen _NewImage(800, 600, 32): _ScreenMove 250, 60
Dim menu$(1 To 4)
menu$(1) = "Help": menu$(2) = "Save": menu$(3) = "Laugh at Pete's joke": menu$(4) = "Quit"
Cls , &HFF000088: _PrintMode _KeepBackground
Do
    sel = getButtonNumberChoice%(menu$())
    Print "You picked: "; menu$(sel)
Loop Until sel = 4

Sub drwBtn (x, y, s$) '200 x 50
    Dim fc~&, bc~&
    Line (x, y)-Step(200, 50), _RGB32(0, 0, 0), BF
    Line (x, y)-Step(197, 47), _RGB32(255, 255, 255), BF
    Line (x + 1, y + 1)-Step(197, 47), &HFFBABABA, BF
    fc~& = _DefaultColor: bc~& = _BackgroundColor ' save color before we chnge
    Color _RGB32(0, 0, 0), &HFFBABABA
    _PrintString (x + 100 - 4 * Len(s$), y + 17), s$
    Color fc~&, bc~& ' restore color
End Sub

'this works pretty good for a menu of buttons to get menu number
Function getButtonNumberChoice% (choice$()) 'this sub uses drwBtn
    ub = UBound(choice$): lb = LBound(choice$)
    For b = lb To ub '   drawing a column of buttons at _width - 210 starting at y = 10
        drwBtn _Width - 210, b * 60 + 10, choice$(b)
    Next
    Do
        While _MouseInput: Wend
        mx = _MouseX: my = _MouseY: mb = _MouseButton(1)
        If mb Then
            Sound 2000, .015
            _Delay .25 ' delay before exit to give user time to release mouse button
            If mx > _Width - 210 And mx <= _Width - 10 Then
                For b = lb To ub
                    If my >= b * 60 + 10 And my <= b * 60 + 60 Then
                        getButtonNumberChoice% = b: Exit Function
                    End If
                Next
                Beep
            Else
                Beep
            End If
        End If
        _Limit 60
    Loop
End Function

My mouse clicks so much never really needed a click. Smile It's more a tock for a clock than a tic for a click.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Is there a menu function? - by Mad Axeman - 12-14-2025, 05:03 PM
RE: Is there a menu function? - by bplus - 12-14-2025, 06:36 PM
RE: Is there a menu function? - by ahenry3068 - 12-14-2025, 07:00 PM
RE: Is there a menu function? - by bplus - 12-14-2025, 07:28 PM
RE: Is there a menu function? - by ahenry3068 - 12-14-2025, 07:54 PM
RE: Is there a menu function? - by bplus - 12-14-2025, 07:59 PM
RE: Is there a menu function? - by ahenry3068 - 12-14-2025, 08:13 PM
RE: Is there a menu function? - by ahenry3068 - 12-15-2025, 02:54 AM
RE: Is there a menu function? - by bplus - 12-14-2025, 08:16 PM
RE: Is there a menu function? - by ahenry3068 - 12-14-2025, 08:42 PM
RE: Is there a menu function? - by Mad Axeman - 12-14-2025, 11:16 PM
RE: Is there a menu function? - by Petr - 12-15-2025, 07:53 AM
RE: Is there a menu function? - by Mad Axeman - 12-15-2025, 09:05 AM
RE: Is there a menu function? - by Petr - 12-15-2025, 11:02 AM
RE: Is there a menu function? - by Mad Axeman - 12-15-2025, 11:13 AM
RE: Is there a menu function? - by bplus - 12-16-2025, 01:58 AM
RE: Is there a menu function? - by Pete - 12-16-2025, 10:28 PM
RE: Is there a menu function? - by SMcNeill - 12-17-2025, 04:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Star Suggestion for new REPLACE$() function zaadstra 3 262 01-26-2026, 05:11 PM
Last Post: grymmjack
  Universal Menu Concept Pete 3 385 01-05-2026, 07:31 PM
Last Post: Pete
  Trying to create a simple menu CMR 8 1,239 06-18-2025, 06:59 PM
Last Post: CookieOscar
  Another way to use Hardware Images and Transparency (alpha channel) for a PopUp Menu TempodiBasic 1 520 03-30-2025, 05:10 PM
Last Post: Pete
  Using the Screen function PhilOfPerth 19 3,093 04-16-2024, 05:23 PM
Last Post: bobalooie

Forum Jump:


Users browsing this thread: 1 Guest(s)