Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

how can i track mouse SCROLL events in the simulator (windows 10)?
Started by pahuchiy Dec 06 2019 08:10 PM

* - - - - 1 votes
6 replies to this topic

Best Answer roaminggamer , 08 December 2019 - 04:10 PM

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.

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

pahuchiy

[GLOBAL: userInfoPane.html]
pahuchiy
  • Observer

  • 26 posts
  • Corona SDK

how can i track mouse SCROLL events in the simulator (windows 10)?



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,103 posts
  • Corona SDK

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.


  • pixec likes this

[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,613 posts
  • Corona SDK

XeduR @Spyric is right.
 
In addition  you can find out more about the mouse event and listeners by:
 
1. Start on the API docs page: https://docs.coronalabs.com/api/
2. Look to the left and see the events list.
3. Find the mouse event and click it: https://docs.coronalabs.com/api/event/mouse/index.html
4. 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

Edited by roaminggamer, 08 December 2019 - 04:06 PM.

  • pahuchiy likes this

[TOPIC: post.html]
#4

pahuchiy

[GLOBAL: userInfoPane.html]
pahuchiy
  • Observer

  • 26 posts
  • Corona SDK

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?



[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,613 posts
  • Corona SDK

1. The docs are great, but I always dig in case something was missed and not added to the docs.

2. It means I scrolled the wheel. You should do this on your own and puzzle out how much scrolling you see, etc.

3. 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.
  • pahuchiy likes this

[TOPIC: post.html]
#6

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,613 posts
  • Corona SDK

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 )

Edited by roaminggamer, 08 December 2019 - 04:13 PM.

  • pahuchiy likes this

[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,613 posts
  • Corona SDK

  Best Answer

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.
  • XeduR @Spyric and pahuchiy like this


[topic_controls]
[/topic_controls]