Closed linux-man closed 7 years ago
I haven't looked at it in a while, but all widgets should fire an "onChange" event when their "value" changes; you should be able to listen for that event and call scrollBy or set the scrollY or scrollX properties. Let me know if that helps, if not I'll write up an example.
Thank you. I wasn't doing :reshape after changing scrollY. It works using the (pseudo) code:
maxScroll = number_of_buttons * buttons_height - panel_height
slider:onChange(function (event)
panel.scrollY = (1 - event.value) * maxScroll
panel:reshape()
end)
panel:onWheelMove(function (event)
slider.value = 1 - panel.scrollY / maxScroll
end)
Glad you got it working, thanks for posting the example code!
I want to create at run time a panel with a variable list of buttons (or labels). I'm aware that I can scroll using the mouse wheel, but I want to do it using a slider. scrollBy function works, but I can't figure how to synchronize scrolling and slider position.