This code works as expected on Windows 10 but not on Catalina.
On macOS Catalina 10.15.4 using PB572, left and right mouse clicks are sometimes detected on a disabled image gadget. No mouse clicks detected on Windows 10.
Code: Select all
OpenWindow(0, 0, 0, 200, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(0, 10, 1, 180, 20, "", #PB_Text_Center)
BoxSize=40
CreateImage(0, BoxSize, BoxSize)
StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0,0,BoxSize,BoxSize,RGB(0,255,0))
StopDrawing()
CreateImage(1, BoxSize, BoxSize)
StartDrawing(ImageOutput(1))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0,0,BoxSize,BoxSize,RGB(255,0,0))
StopDrawing()
ImageGadget(1, 40, 40, BoxSize, BoxSize, ImageID(0))
ImageGadget(2,120, 40, BoxSize, BoxSize, ImageID(0))
Global LClicks = 0
Global RClicks = 0
Global BIG = 0
Global EVT = 0
Procedure OffOn()
If BIG = 1
DisableGadget(1, 1)
DisableGadget(2, 0)
SetGadgetState(1, ImageID(1))
SetGadgetState(2, ImageID(0))
Else
DisableGadget(1, 0)
DisableGadget(2, 1)
SetGadgetState(1, ImageID(0))
SetGadgetState(2, ImageID(1))
EndIf
SetGadgetText(0, "BIG " + Str(BIG) + " L " + Str(LClicks) + " R " + Str(RClicks))
EndProcedure
Repeat
Event = WaitWindowEvent(100)
If Event = #PB_Event_Gadget
BIG = EventGadget()
EVT = EventType()
If EVT = #PB_EventType_LeftClick
LClicks = LClicks + 1
OffOn()
EndIf
If EVT = #PB_EventType_RightClick
RClicks = RClicks + 1
OffOn()
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
End
Using GetGadgetState() instead of DisableGadget() as a workaround.