How to track the scroll position of a WowScrollBoxList
I would like my addon to keep track of the current scroll position of the achievements frame scroll box.
But the scroll box only seems to have an OnMouseWheel script. Lua Code:
The same goes for its scroll bar. Lua Code:
But what if the user changes the scroll position dragging the scroll bar or clicking the scroll bar steppers? Are there scripts to hook as well? Is there not an easier way? Like a scroll frames' OnVerticalScroll script? |
I'm seeing more, but ultimately, all of .ScrollBox's scripts manipulate .ScrollBar, which fires an OnScroll event through its inherited CallbackRegistry. The event fires with the scroll percent, so you don't need to fetch it yourself.
Lua Code:
Sources of note: ScrollUtil.InitScrollFrameWithScrollBar() - SharedXML/Scroll/ScrollUtil.lua:197 ScrollBarMixin:SetScrollPercentage() & ScrollBarMixin:SetScrollPercentageInternal() - SharedXML/Scroll/ScrollBar.lua:163 & 180 |
Thank you so much! This worked perfectly. :)
Could you also tell me how to do this in Wrath Classic? I tried this: Lua Code:
But AchievementFrameAchievementsContainer.scrollBar does not seem to have Event. In general: What did you do to see all the scripts of the scroll bar/box? Could you recommend a resource where I could learn about the details of CallbackRegistries? |
Quote:
Lua Code:
Quote:
Quote:
https://warcraft.wiki.gg/wiki/EventRegistry Note: The linked page appears to be a merged topic on the EventRegistry (aka GlobalCallbackRegistry), but there is a section about the CallbackRegistryMixin. If you want to see the relevant code yourself: SharedXML/GlobalCallbackRegistry.lua SharedXML/CallbackRegistry.lua |
Great! Thanks again! :)
|
All times are GMT -6. The time now is 03:24 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI