How do I get the scrollbar buttons to keep repeating?


21-12-2012 19:29:07

Hi all,
When I make a scrollview, the buttons on the scrollbar only seem to work when I click them once. I want the scrollbar to keep scrolling, the longer I hold the mouse button down. But I don't know how to make this happen. Any advice for me?

- Goishin


26-12-2012 01:52:14

Here is idea that does not require intervention into MyGUI codebase. However maybe it is better to do so because that idea is not that good...

You should determine whether it is possible to catch scroll down button pressed event. If so, you can try that:

In callback (the delegated method that you should set on scroll button click) you should start timer. And you should stop timer when button released.

Then in your frameStarted (or in the main loop of your application) you should check that timer. If timer exceeded some value (say 0.5 seconds if you want to scroll 2 times a second) you should manually call method for scrolling the respective scroll-view and immediately after scrolling you should reset that timer.

The implementation of that thing depends on your program's architecture.

Timer checking goes in one place and events of button press and button release in some callback. Somehow you should stop checking timer when button released. And somehow you should know what the button being pressed when you checking the timer.