01-13-2026, 11:20 AM
Code: (Select All)
Screen _NewImage(800, 600, 32)
Dim Tabs(1 To 5) As String
Tabs(1) = "Hello"
Tabs(2) = "World"
Tabs(3) = "Steve"
Tabs(4) = "Is"
Tabs(5) = "Awesome"
Color _RGB32(0, 0, 0), 0
tabon = 1
TabWidth = 160
TabHeight = 30
Do
While _MouseInput: Wend
For i = 1 To UBound(Tabs)
tx = (i - 1) * TabWidth
' Hover detection
If _MouseX >= tx And _MouseX <= tx + TabWidth And _MouseY <= TabHeight Then isOver = -1 Else isOver = 0
' Click detection
If _MouseButton(1) And isOver Then tabon = i
' Visual state
If tabon = i Then 'active
DrawTab tx, 0, TabWidth, TabHeight, Tabs(i), 1
ElseIf isOver Then 'hover
DrawTab tx, 0, TabWidth, TabHeight, Tabs(i), 2
Else 'inactive
DrawTab tx, 0, TabWidth, TabHeight, Tabs(i), 0
End If
Next
_Limit 30
_Display
Loop
Sub DrawTab (x As Integer, y As Integer, w As Integer, h As Integer, label As String, state As Integer)
' state: 0 = normal, 1 = active, 2 = hover
Dim face As _Unsigned Long, border As _Unsigned Long
Select Case state
Case 0: face = _RGB32(180, 180, 200): border = _RGB32(80, 80, 110) 'inactive
Case 1: face = _RGB32(230, 230, 255): border = _RGB32(40, 40, 80) ' active
Case 2: face = _RGB32(200, 200, 230): border = _RGB32(60, 60, 90) ' hover
End Select
Line (x, y)-(x + w, y + h), face, BF
Line (x, y)-(x + w, y), border
Line (x, y)-(x, y + h), border
Line (x + w, y)-(x + w, y + h), border
tw = _PrintWidth(label)
th = _FontHeight
_PrintString (x + (w - tw) \ 2, y + (h - th) \ 2), label
End Sub
I converted my Constant Tool to make use of Tabs for ease of selectability and such. This is basically the system I tossed into it, pulled out and shared here to try and make it simple for others to make use of for their own projects and such if they ever want.
It's about as simple as they come, but tracks three different states for our tabs for us -- Active, Inactive, and Hover -- and it gives visual feedback and color changes to showcase each of those three states for us.
Hopefully this should be easy enough to plug into any other program that someone wants. If anyone needs help with it in the future, just speak up and post and I'll do what I can help sort you out with it.

