03-30-2025, 04:44 PM
Hi
@Pete
using Hardware images in Screen 0 for buttons and menus..
Q1: how many menus do you have ? Build an image for each menu and make it an hardware accelerated image!
Q2: how many buttons do you have? Build an image for each button and make it an hardware accelerated image!
And for the Hover selection effect? Well you need of another hardware accelerated image with a grade of transparency to cover the area of selection pointed by mouse!
here screenshots:
window in screen 0 and button with hardware graphic
![[Image: 1-Hardware-study3.jpg]](https://i.ibb.co/prMm32HZ/1-Hardware-study3.jpg)
window in screen 0 software graphic, popupmenu over button and hover popup menu in hardware graphic
![[Image: 2-hardware-study3.jpg]](https://i.ibb.co/bg0M7MfC/2-hardware-study3.jpg)
here the code:
@Pete
using Hardware images in Screen 0 for buttons and menus..
Q1: how many menus do you have ? Build an image for each menu and make it an hardware accelerated image!
Q2: how many buttons do you have? Build an image for each button and make it an hardware accelerated image!
And for the Hover selection effect? Well you need of another hardware accelerated image with a grade of transparency to cover the area of selection pointed by mouse!
here screenshots:
window in screen 0 and button with hardware graphic
![[Image: 1-Hardware-study3.jpg]](https://i.ibb.co/prMm32HZ/1-Hardware-study3.jpg)
window in screen 0 software graphic, popupmenu over button and hover popup menu in hardware graphic
![[Image: 2-hardware-study3.jpg]](https://i.ibb.co/bg0M7MfC/2-hardware-study3.jpg)
here the code:
Code: (Select All)
Screen 0
_DisplayOrder _Software , _Hardware ' this says only what must be shown
Dim As Long Img1, Img2, Img3
Dim As Integer X, Y, Mb, Xm, Ym
' here it creates a square to overlap menu to make the shadow of selection
Img1 = _NewImage(112, 16, 32)
_Dest Img1
Cls , _RGBA32(127, 205, 255, 125)
Img1 = _CopyImage(Img1, 33)
' here it creates the Button image
Img2 = _NewImage(100, 50, 32)
_Dest Img2
Cls , _RGBA32(127, 0, 255, 180)
Color _RGBA32(0, 10, 140, 180), _RGBA32(0, 0, 0, 100)
_PrintString (10, 17), "Click Here"
Img2 = _CopyImage(Img2, 33)
' it creates image of popup from screen 0
Img3 = _NewImage(112, 64, 32)
_Dest Img3
Color _RGBA32(211, 166, 6, 255), _RGBA32(44, 44, 255, 255)
'Locate 1, 1
_PrintString (1, 1), "New.....Ctrl+N"
'Locate , 1
_PrintString (1, 16), "Open....Ctrl+O"
'Locate , 1
_PrintString (1, 32), "Close...Ctrl+X"
'Locate , 1
_PrintString (1, 48), "Quit....Ctrl+Q"
Img3 = _CopyImage(Img3, 33)
Screen 0
' inizialization and main loop
_Dest 0
Color 11, 3
Cls , 2
X = 0
Y = 0
Xm = 0
Ym = 0
Mb = 0
Do
Cls , 2
Locate 1, 1: Print "Left click to show popup menu"; ' it shows help on first line of text
_PutImage (300, 300), Img2, 0 ' button
If _MouseInput Then
X = _MouseX
Y = _MouseY
If _MouseButton(1) Then Mb = 1
If _MouseButton(2) Then Mb = 2
End If
If Mb = 1 Then
If X < 1 Or X + 13 > 80 Or Y < 1 Or Y + 3 > 24 Then
Beep ' mouse's popup menu goes out of window's area
Else
Xm = X: Ym = Y ' X and Y for popup and hovering menu
' popup menu
End If
Mb = 0
End If
If Xm And Ym Then
_PutImage (1 + ((Xm - 1) * 8), 1 + ((Ym - 1) * 16)), Img3, 0
If (X >= Xm And X <= Xm + 13) And (Y >= Ym And Y <= Ym + 3) Then
_PutImage ((Xm - 1) * 8, (Y - 1) * 16), Img1, 0 ' hover / selection item of popup menu
End If
End If
_Display
Loop Until Mb = 2
_FreeImage Img1
_FreeImage Img2
_FreeImage Img3
End

