4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Just starting out? Need help? Post your questions and find answers here.
User avatar
IceSoft
Addict
Addict
Posts: 1696
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by IceSoft »

Canvas: #PB_EventType_MouseWheel does not work.

For tests source:
Replace on the canvas example source.

Code: Select all

          Select EventType()
            Case #PB_EventType_MouseWheel
              MessageRequester("Wheel","works now.")
          
            Case #PB_EventType_LeftButtonDown
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
atomo
User
User
Posts: 65
Joined: Thu May 22, 2008 10:32 pm

Re: 4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by atomo »

You must use the flag #PB_Canvas_Keyboard on CanvasGadget creation to get MouseWheel events.
User avatar
IceSoft
Addict
Addict
Posts: 1696
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: 4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by IceSoft »

atomo wrote:You must use the flag #PB_Canvas_Keyboard on CanvasGadget creation to get MouseWheel events.
Have you tried it?
On my deployment (Windows 7 64bit) it is not working, also not with the #PB_Canvas_Keyboard flag.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
atomo
User
User
Posts: 65
Joined: Thu May 22, 2008 10:32 pm

Re: 4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by atomo »

This code works for me, the CanvasGadget must also have the focus :

Code: Select all

Window = OpenWindow(#PB_Any, 0, 0, 200, 200, "CanvasGadget", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If Window
  CanvasGadget = CanvasGadget(#PB_Any, 0, 0, 200, 200, #PB_Canvas_Keyboard)
  Repeat
    Event = WaitWindowEvent(1)
    If Event = #PB_Event_Gadget
      If EventGadget() = CanvasGadget
        If EventType() = #PB_EventType_MouseWheel
          Debug "MouseWheel"
        EndIf
      EndIf
    EndIf    
  Until Event = #PB_Event_CloseWindow
EndIf
User avatar
IceSoft
Addict
Addict
Posts: 1696
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: 4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by IceSoft »

@atome,
Your code works only if I pressed the mousebutton before.
=> that is the bug.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 206
Joined: Mon Jun 09, 2003 8:30 am

Re: 4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by bobobo »

Focus !!
A SetActiveGadget(CanvasGadget) before Repeat will do
사십 둘 .
User avatar
STARGÅTE
Addict
Addict
Posts: 2236
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: 4.60B3: Canvas: #PB_EventType_MouseWheel does not work.

Post by STARGÅTE »

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 
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply