how can i track mouse SCROLL events in the simulator (windows 10)?
I thought I answered this already. Seems that my post has just disappeared.
In order to check for mouse events, you need to simulate an Android device, i.e. view > view as > pick an Android device.
XeduR @Spyric is right.
In addition you can find out more about the mouse event and listeners by:
-
Start on the API docs page: https://docs.coronalabs.com/api/
-
Look to the left and see the events list.
-
Find the mouse event and click it: https://docs.coronalabs.com/api/event/mouse/index.html
-
Dig around in all the links from this page and you’ll find what you need.
As a way to experiment you could run this code using the correct simulated device (i.e. one that supports mouse events as mentioned above):local function mouse( event ) print ("\n--------------------- @", event.time ) for k,v in pairs(event) do print( k, v ) end end Runtime:addEventListener( “mouse”, mouse )
Now, use the scroller on your mouse and violla, you’ll see what you need to build your own custom listeners.
I did this and got output like this when scrolling:
12:21:11.155 --------------------- @ 9016.3 12:21:11.155 isSecondaryButtonDown false 12:21:11.155 isMiddleButtonDown false 12:21:11.155 isCtrlDown false 12:21:11.155 type scroll 12:21:11.155 isPrimaryButtonDown false 12:21:11.155 scrollY 83.199996948242 12:21:11.155 isCommandDown false 12:21:11.155 y 182.90740966797 12:21:11.155 x 127.40740966797 12:21:11.155 name mouse 12:21:11.155 isShiftDown false 12:21:11.155 isAltDown false 12:21:11.155 time 9016.3 12:21:11.155 scrollX 0 12:21:11.155 clickCount 0
thanks. I deleted the previous topic because I forgot to specify SCROLL
scrollY is not documented https://docs.coronalabs.com/api/event/mouse/index.html. therefore asked
what does scrollY value (83.199996948242) mean?
-
The docs are great, but I always dig in case something was missed and not added to the docs.
-
It means I scrolled the wheel. You should do this on your own and puzzle out how much scrolling you see, etc.
-
Scrolling amounts will vary (by number of pixels) based on how you have your mouse set up in the host OS and some other factors.
SO… when you make an app that handles/takes scrolling as an input, you need to give the user a way to make the response more or less sensitive. The takeaway is that not all target systems will be set up the same way so you as the developer are responsible for giving the user a way to tweak it to suit their needs.
If you tried this, you’ll probably notice the listener prints A LOT of messages.
Since you only care to dig into scrolling, you can do this to make the listener quieter and the output more meaningful to your digging.
local function mouse( event ) if( event.type ~= 'scroll' ) then return false end print ("\n--------------------- @", event.time ) for k,v in pairs(event) do print( k, v ) end end Runtime:addEventListener( "mouse", mouse )
Note: I already did this for https://docs.coronalabs.com/api/event/mouse/index.html, but remember that when you find a issue with the docs, you should click the ‘report issue’ button at the bottom of the page and give clear, concise, and precise feedback on the issue. That helps us all.
Again, I already did this for the mouse event based on what you reported above.