Your code works only if I pressed the mousebutton before.
=> that is the bug.
No it is not, because the gadget must be activated first:
MouseWheel not "same" as MouseMove or so... it needs a focus
Code: Select all
Window = OpenWindow(#PB_Any, 0, 0, 400, 200, "CanvasGadget", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If Window
CanvasGadget1 = CanvasGadget(#PB_Any, 0, 0, 200, 200, #PB_Canvas_Keyboard|#PB_Canvas_DrawFocus)
CanvasGadget2 = CanvasGadget(#PB_Any, 200, 0, 200, 200, #PB_Canvas_Keyboard|#PB_Canvas_DrawFocus)
Repeat
Event = WaitWindowEvent(1)
If Event = #PB_Event_Gadget
Select EventGadget()
Case CanvasGadget1
Select EventType()
Case #PB_EventType_MouseWheel
Debug "MouseWheel 1"
Case #PB_EventType_MouseMove
Debug "MouseMove 1"
EndSelect
Case CanvasGadget2
Select EventType()
Case #PB_EventType_MouseWheel
Debug "MouseWheel 2"
Case #PB_EventType_MouseMove
Debug "MouseMove 2"
EndSelect
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf