We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a Logitech MX Master which has a vertical and horizontal scroll wheel. The following way of tracking wheel changes works only for the vertical wheel. Is there a way to do the same for the horizontal wheel?
void mouseWheel(MouseEvent event) {
float e = event.getCount();
}
Thanks in advance, Alex
Answers
If you're on Mac,
Source - http://stackoverflow.com/questions/22851022/horizontal-scrolling-with-mousewheellistener
I searched a lot, but couldn't find out how Windows interprets horizontal mouse wheel scrolling.
@Lord_Of_The_Galaxy Thanks a lot for your help! I am in windows but want to give it a shot. How would I implement the code in your link?
I believe it won't work, but here it is anyway -
Why do you need the question mark at line 10?
@colouredmirrorball Mistake, thanks!
Damn, you got me all excited with thinking there was some new nifty syntax to be discovered! :P
Unfortunately it doesn't work :/
@Lord_of_the_Galaxy It is not common to process info from the MouseEvent object... I haven't seen much of it anyways here in the forum. Do you happen to have a reference to it? (It will complement this post by providing a better insight to MEvnt handling)
@Alex_Pr I will suggest doing a java + double scroll wheel search and see if anything alike have already being implemented in the Java universe. Whatever you find there, it could be use here. If Processing hasn't implemented it through their MouseEvent handling class, then you could submit a feature request.
Kf
@Alex_Pr try testin it on a Mac system, if you have access to one. It should work. But, like I said, it won't work on Windows. One could try experimenting to figure out a solution.
@kfrajer I just happen to know a bit of how Processing works internally, but I think it must be documented here - http://processing.github.io/processing-javadocs/core/
The best approach would be to use a bunch of println() statements and figure out what is the difference between a horizontal and vertical scroll wheel mouse event.
http://processing.github.io/processing-javadocs/core/processing/event/MouseEvent.html
So it is documented (to some extent) over there.
Thanks @Lord_of_the_Galaxy
Kf
@colouredmirrorball I have already tried a
println(me)
in Lord_Of_The_Galaxy's code but nothing is printed when I use the side scrollWheel. It does not recognize the horizontal scroll as an eventNow that's even worse :(
I am not sure if it will be supported by processing. For example:
https://github.com/processing/processing/blob/master/core/src/processing/event/MouseEvent.java
The MouseEvent only detects a wheel action. Does your second wheel triggers the following code at all?
One attempt is:
Does your second wheel trigger the mouseWheel? Do you get code 8?
I notice in the source code you can get to output UNKNOWN when calling get action. I wonder if one can have access to mouseEvent within draw and check if the second mouse wheel triggers the UNKNOWN action. If it does, then accessing the second wheel event could be possible. However, I don't know how to get access to the MouseEvent in draw(). I am guessing mouseEvent gets registered to the main thread (?). I will need to dig into the source code to see if it is possible to do this.... Or maybe somebody knows?
Kf
We may need to look at the complete code to figure out what happens on horizontal scroll.
Please test horizontal scroll on your mouse (use my code), and tell us what gets printed.
@kfrajer , @Lord_of_the_Galaxy none of the codes print anything when I use the horizontal scroll wheel.
Then apparently Java itself doesn't know of horizontal scroll wheel.