Scrollable panel

  • 2 Replies
Scrollable panel
« on: 22 June 2016, 16:02:37 »
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?



  • *****
  • 1631
    • View Profile
    • Texus's Blog
Re: Scrollable panel
« Reply #1 on: 22 June 2016, 16:11:19 »
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(, 0, 0);

Re: Scrollable panel
« Reply #2 on: 22 June 2016, 16:22:22 »
Ok, thank you.

Works perfectly!
« Last Edit: 22 June 2016, 22:40:03 by roccio »