View Single Post
02/10/15, 04:53 PM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
After I was interrupted by maintenance on the PTS, I went to live and experienced the same issue. I tried doing the calculations in ResizeScrollBar by hand, and got correct results. Then with some hooks I found out that by the time I filled the list and called ZO_ScrollList_Commit, list:GetHeight() was 713 and list.scrollbar:GetHeight() was 681. I have no idea why, but feeding these numbers into ResizeScrollBar, you get 667.

Then there was a second ZO_ScrollList_Commit call, which wasn't coming from my code, but from OnContentsUpdate. According to ZOS comments, it's a deferred commit until after anchors were processed. But the heights were still 713 and 681.

Then, looking at the broken scrollbar ingame, I tried /script ZO_ScrollList_Commit(list) ... and it fixed itself. list:GetHeight() was 677 and list.scrollbar:GetHeight() was 645.

Conclusion: I probably called ZO_ScrollList_Commit in some intermediate state where the list already had non-zero height, but it was not final as not all anchors had been processed yet. I didn't set the height directly - the list had TOPLEFT anchored to one control, and BOTTOMRIGHT to another. And although I don't move any of the involved controls around after construction, somehow it doesn't get the correct height immediately. I guess it'll be safest to ZO_ScrollList_SetHeight explicitly to avoid any issues.
  Reply With Quote