Scrollable panel

Started by roccio, 22 June 2016, 16:02:37

roccio

Hello, I have a panel I want to scroll and I have taken the code from the "scrollable panel" example. All works well, but I would like to scroll even when I use the mouse wheel over the panel. How can I do this?

texus

TGUI currently does not support that.

You will have to do it manually in your code. When you receive an sf::Event::MouseWheelMoved then you should check whether the mouse is on top of the panel and not on top of the scrollbar. The mouse coordinates are in event.mouseWheel and you can get the areas of the panel and scrollbar using their getAbsolutePosition() and getSize() functions. When the mouse is located there, call scrollbar->mouseWheelMoved(event.mouseWheel.delta, 0, 0);

roccio

#2
Ok, thank you.

Works perfectly!