# Trying to understand how to scroll and have cursor

**URL:** <https://discourse.glfw.org/t/trying-to-understand-how-to-scroll-and-have-cursor/1872>\
**Category:** support\
**Created:** [June 12, 2021, 3:13pm UTC](https://discourse.glfw.org/t/trying-to-understand-how-to-scroll-and-have-cursor/1872 "2021-06-12T15:13:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hydrodog](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hydrodog](https://discourse.glfw.org/u/hydrodog)\
**Post date:** [June 12, 2021, 3:13pm UTC](https://discourse.glfw.org/t/trying-to-understand-how-to-scroll-and-have-cursor/1872/1 "2021-06-12T15:13:26Z")

</div>

The documentation says that in order to get full mouse information the cursor must be turned off. Yet a cursor is actually quite useful. It’s ok to lock into the application, but if I want to draw a cursor, is there any way to do so? For example, if I wish to zoom in around the point where the mouse is, the user needs to see the mouse pointer.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [June 12, 2021, 4:07pm UTC](https://discourse.glfw.org/t/trying-to-understand-how-to-scroll-and-have-cursor/1872/2 "2021-06-12T16:07:36Z")

</div>

Hi @hydrodog,

welcome to the GLFW forum.

If the cursor is enabled [glfwGetCursorPos](https://www.glfw.org/docs/latest/input_guide.html#cursor_pos) will return the position of the cursor within the window, so if you want to zoom in on a point where the mouse is then this will provide that functionality.

You only need to disable the cursor if you want to get motion of the mouse _beyond_ the bounds of the window, or use [Raw Mouse Motion](https://www.glfw.org/docs/latest/input_guide.html#raw_mouse_motion). If you then want to draw a cursor, you can do draw it yourself (you’ll need to clamp the movement to the bounds of the window yourself in this case) - though having the cursor enabled will be the most suitable option in most cases.

Cheers,  
Doug

---

<div class="post-metadata">

**Author:** ![hydrodog](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hydrodog](https://discourse.glfw.org/u/hydrodog)\
**Post date:** [June 12, 2021, 9:33pm UTC](https://discourse.glfw.org/t/trying-to-understand-how-to-scroll-and-have-cursor/1872/3 "2021-06-12T21:33:50Z")

</div>

Thanks! But when the cursor is enabled the scroll callback did not seem to work?  
I will check again.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [June 13, 2021, 10:28am UTC](https://discourse.glfw.org/t/trying-to-understand-how-to-scroll-and-have-cursor/1872/4 "2021-06-13T10:28:47Z")

</div>

The scroll callback should work the same in both cursor modes.
