02-19-2025, 06:58 AM
For a quick demo of what I'm talking about, see here:
Code: (Select All)
Dim buttons(1) 'just two simple buttons for the demo
button(0) = MakeButton("Hello World")
button(1) = MakeButton("STEVE!")
x = 100 'just for moveable button
Cls , 4 'a red screen for a background
Do
_PutImage (x, 100), button(0)
_PutImage (200, 200), button(1)
k = _KeyHit
Select Case k 'left/right arrow to move that button
Case 19200: x = x - 3: If x < 0 Then x = 0
Case 19712: x = x + 3: If x > _Width * _FontWidth - 100 Then x = _Width * _FontWidth - 100
Case Is > 0: System 'any other key to end
End Select
_Display
_Limit 30
Loop
Function MakeButton (caption$)
d = _Dest
temp = _NewImage(_FontWidth * Len(caption$) + 4, _FontHeight + 4, 32)
_Dest temp
Color &HFFFFFFFF&&, 0 ' bright white text with no background
Cls , &HFF0000FF&& 'dark blue background for this button
Line (0, 0)-(_Width - 1, _Height - 1), &HFFFFFFFF, B 'white trim around the edges
Line (1, 1)-(_Width - 2, _Height - 2), &HFFFFFFFF, B '2 pixel trim
_PrintString (3, 3), caption$ 'print the caption
MakeButton = _CopyImage(temp, 33) 'make the hardware button
_Dest d 'restore the destination
_FreeImage temp 'free the temp image
End Function

