# Focusing by mouse wheel rotate on 3.x

**URL:** <https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193>\
**Category:** support\
**Created:** [August 28, 2013, 11:01pm UTC](https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193 "2013-08-28T23:01:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 28, 2013, 11:01pm UTC](https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193/1 "2013-08-28T23:01:20Z")

</div>

**[q66680](https://sourceforge.net/u/q66680/)** wrote on [Wednesday, August 28, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/be8b00dd/#ae63):

hi.How to assign mouse wheell scroll up/down to

zoom in/zoom out on 3.x? I need an example about

glfwSetScrollCallback() to learn How to use?

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 29, 2013, 1:32pm UTC](https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193/2 "2013-08-29T13:32:13Z")

</div>

**[q66680](https://sourceforge.net/u/q66680/)** wrote on [Thursday, August 29, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/be8b00dd/#13ec):

i added this lines in my code.

void scroll(GLFWwindow\* window,double x,double y){  
std::cout\<\<x\<\<’\n’;  
}  
glfwSetScrollCallback(window,scroll);

Then i build the code and run without any error.Then i began to play mouse scroll. (a logitech’s scroll with 4 functions its accept push right/left)

when i scroll up/down its write to console “0” push right write “1” push left

write “-1” and not write anything else.Also i never get error.

What is mean these number? How to i use this about zoom event?

I am on linux-X11-mesa9.1(with GL 3.1) radeon HD 5450(desktop)  
and use “forward-compatible”

EDIT:Because, i request to print only x-axis scroll above code that correspond by push left/right.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 29, 2013, 2:14pm UTC](https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193/3 "2013-08-29T14:14:09Z")

</div>

**[q66680](https://sourceforge.net/u/q66680/)** wrote on [Thursday, August 29, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/be8b00dd/#0859):

OK.i found a way! -1= multiply it a scalar and use for zoom out

1= multiply it a scalar and use for zoom in. Or vice versa.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 29, 2013, 2:59pm UTC](https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193/4 "2013-08-29T14:59:59Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Thursday, August 29, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/be8b00dd/#6aec):

I’ve not used this functionality, but from the docs it looks like you should use the y value for scroll up/down, as the x value is scroll left/right.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 29, 2013, 4:04pm UTC](https://discourse.glfw.org/t/focusing-by-mouse-wheel-rotate-on-3-x/193/5 "2013-08-29T16:04:02Z")

</div>

**[q66680](https://sourceforge.net/u/q66680/)** wrote on [Thursday, August 29, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/be8b00dd/#dcf2):

yes.i saw.escape my eyes.
