Hello,
Would that be possible to get horizontal mousewheel as well as the current vertical mousewhell?
Thanks!
Canvas Horizontal MouseWheel
Re: Canvas Horizontal MouseWheel
No, because this event is not a standard windows event.
It is from your mouse driver (for example logitech).
This also applies to the forward and back buttons on the mouse.
Edit:
Example with callback:
It is from your mouse driver (for example logitech).
This also applies to the forward and back buttons on the mouse.
Edit:
Example with callback:
Code: Select all
Enumeration
#Window
#Gadget
EndEnumeration
Enumeration
#WM_MOUSEHWHEEL = $020E
#WM_XBUTTONDOWN = $020B
EndEnumeration
Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
Select Message
Case #WM_MOUSEHWHEEL
Debug "horizontal wheel: "+Str((wParam>>16)/120)
Case #WM_XBUTTONDOWN
Select wParam>>16
Case 1
Debug "back"
Case 2
Debug "forward"
EndSelect
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
OpenWindow(#Window, 0, 0, 800, 600, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SetWindowCallback(@MyWindowCallback(), #Window)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
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 more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Canvas Horizontal MouseWheel
Don't know about Windows, but on MacOSX with Carbon it's possible:
http://developer.apple.com/carbon/tipsa ... MouseWheel
As the most common application in Windows can handle any horizontal mousewheel I guess there's a way too!
http://developer.apple.com/carbon/tipsa ... MouseWheel
As the most common application in Windows can handle any horizontal mousewheel I guess there's a way too!

Re: Canvas Horizontal MouseWheel
For Mac OS X you only needed to modify my Window handler...Polo wrote:Would that be possible to get horizontal mousewheel as well as the current vertical mousewhell?

Code: Select all
EnableExplicit
#kEventClassMouse = 'mous'
#kEventMouseWheelAxisX = 0
#kEventMouseWheelAxisY = 1
#kEventMouseWheelMoved = 10
#kEventParamMouseWheelAxis = 'mwax'
#kEventParamMouseWheelDelta = 'mwdl'
#typeMouseWheelAxis = 'mwax'
#typeSInt32 = 'long'
#typeUInt32 = 'magn'
Structure EventTypeSpec
EventClass.L
EventKind.L
EndStructure
Define EventHandlerUPP.L
Dim EventTypes.EventTypeSpec(0)
Procedure EventHandler(*NextEventHandler, Event.L, UserData.L)
Protected MouseWheelAxis.L
Protected MouseWheelDelta.L
Protected WheelInfo.S
If GetEventParameter_(Event, #kEventParamMouseWheelAxis, #typeMouseWheelAxis, 0, SizeOf(MouseWheelAxis), 0, @MouseWheelAxis) = 0
Select MouseWheelAxis
Case #kEventMouseWheelAxisX
WheelInfo = "Mouse wheel moved horizontally"
Case #kEventMouseWheelAxisY
WheelInfo = "Mouse wheel moved vertically"
EndSelect
EndIf
If GetEventParameter_(Event, #kEventParamMouseWheelDelta, #typeSInt32, 0, 4, 0, @MouseWheelDelta) = 0
WheelInfo + ", Delta = " + Str(MouseWheelDelta)
Debug WheelInfo
EndIf
EndProcedure
OpenWindow(0, 200, 100, 130, 130, "")
CanvasGadget(0, 10, 10, 110, 110)
StartDrawing(CanvasOutput(0))
Box(0, 0, 180, 180, RGB(249, 230, 191))
StopDrawing()
EventTypes(0)\EventClass = #kEventClassMouse
Eventtypes(0)\EventKind = #kEventMouseWheelMoved
EventHandlerUPP = NewEventHandlerUPP_(@EventHandler())
InstallEventHandler_(GetControlEventTarget_(GadgetID(0)), EventHandlerUPP, 1, @EventTypes(), @EventHandler(), 0)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Canvas Horizontal MouseWheel
Thanks Shardik, you've got the answer for everything when it comes to Carbon 
