12-14-2025, 08:13 PM
(This post was last modified: 12-14-2025, 08:14 PM by ahenry3068.)
(12-14-2025, 07:59 PM)bplus Wrote: I added a Quick Menu.bas, the original demo I was thinking of, to the previous post I made, I like that for it's simplicity.
But by all means Make Your Own! It's a Basic Exercise for any Basic fan!
You wouldn't happen to have a quick QB64 command for a nice Click Sound would you?
I can play around or I could just embed a little Audio sample and use _SNDPLAY but if there is something simple I don't mind cheating for small things .

Code: (Select All)
Type BUTTONTYPE
Height As Integer
Width As Integer
X As Integer
Y As Integer
Image As Long
PushImage As Long
OldImage As Long
CREATED As Integer
ONSCREEN As Integer
End Type
Dim B(0 To 2) As BUTTONTYPE
Screen _NewImage(800, 600, 256)
MAKEBUTTON_LABELBTN 16, B(0), 8, "BUTTON 0"
MAKEBUTTON_LABELBTN 16, B(1), 8, "BUTTON 1"
MAKEBUTTON_LABELBTN 16, B(2), 8, "BUTTON 2"
BUTTONPUT_XY B(0), 10, 10
BUTTONPUT_XY B(1), 120, 120
BUTTONPUT_XY B(2), 310, 250
Dim J As Integer
Do
For J = 0 To 2
PUSH_BUTTON B(J)
Next
_Limit 30
Loop Until InKey$ = Chr$(27)
End
Sub PUSH_BUTTON (BTarget As BUTTONTYPE)
_PutImage (BTarget.X, BTarget.Y), BTarget.PushImage
_Delay .6
_PutImage (BTarget.X, BTarget.Y), BTarget.Image
End Sub
Sub BUTTONPUT_XY (BTarget As BUTTONTYPE, X As Integer, Y As Integer)
BTarget.X = X
BTarget.Y = Y
_PutImage (X, Y), BTarget.Image
BTarget.ONSCREEN = _TRUE
End Sub
Sub MAKEBUTTON_LABELBTN (bFont As Long, NEWBUTTON As BUTTONTYPE, BorderWidth As Integer, Label As String)
Dim CImage As Long
Dim SaveHandle As Long
Dim SavePMode As Integer
Dim C As Integer
Dim X As Integer
Dim I As Integer
Dim TWidth As Integer
Dim THeight As Integer
SaveHandle = _Font
_Font bFont
NEWBUTTON.Height = _FontHeight(bFont) + 8 + (BorderWidth * 2)
NEWBUTTON.Width = _PrintWidth(Label) + 12 + (BorderWidth * 2)
_Font SaveHandle
SaveHandle = _Dest
NEWBUTTON.Image = _NewImage(NEWBUTTON.Width, NEWBUTTON.Height, 256)
NEWBUTTON.OldImage = _NewImage(NEWBUTTON.Width, NEWBUTTON.Height, 256)
C = 0
For I = 16 To 31
Print I, C
_PaletteColor I, _RGB32(C, C, C, 255), NEWBUTTON.Image
C = C + 16
Next
_Dest NEWBUTTON.Image
TWidth = NEWBUTTON.Width
THeight = NEWBUTTON.Height
X = 0
Y = 0
I = 1
If BorderWidth > 0 Then
C = &H11
Do
Line (X, Y)-(X + (TWidth - 1), Y + (THeight - 1)), C, BF
C = C + 1
I = I + 1
TWidth = TWidth - 2
THeight = THeight - 2
X = X + 1
Y = Y + 1
Loop Until I = BorderWidth
Else
C = &H15
Line (X, Y)-(X + (TWidth - 1), Y + (THeight - 1)), C, BF
End If
NEWBUTTON.PushImage = _CopyImage(NEWBUTTON.Image)
_Font bFont, NEWBUTTON.Image
_PrintMode _KeepBackground , NEWBUTTON.Image
Color 0
_PrintString (0 + BorderWidth + 8, 0 + BorderWidth + 6), Label, NEWBUTTON.Image
_Dest NEWBUTTON.PushImage
_PrintMode _KeepBackground
Color 15
_PrintString (0 + BorderWidth + 8, 0 + BorderWidth + 6), Label, NEWBUTTON.PushImage
_Dest NEWBUTTON.Image
Color 15
_PrintString (0 + BorderWidth + 6, 0 + BorderWidth + 4), Label, NEWBUTTON.Image
_Dest SaveHandle
End Sub

