View Single Post
02/10/15, 07:07 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
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.
618 + 2*16 = 713 -- it leaves room for the UP/DOWN scroll buttons


Originally Posted by merlight View Post
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.
If you had your anchors set the second commit was probably comming from when you added your data type. Everytime you add a new dataType this also calls ZO_ScrollList_Commit.
Lua Code:
  1. function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)


Originally Posted by merlight View Post
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.
One of my scrollLists is set up just like yours it sounds, with both corners anchored & as soon as I dump the data in I call ZO_ScrollList_Commit on the next line without any delay. Mine doesn't have any problems like that though.

Are the controls you anchored it to from an addon? Any chance they moved or changed size which would have changed the placement of your anchors & changed the size of your scrollList ? Especially if one of those controls has something like ResizeToFitXXXX() and its contents or padding changed. Or someone set dimensions/position in XML, then reset it in lua and changed it by a small amount. It wouldn't take much of a change, those numbers aren't off by much.

Last edited by circonian : 02/10/15 at 07:14 PM.
  Reply With Quote