View Single Post
07/25/14, 12:58 PM   #28
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by zgrssd View Post
I would not say it is more complex. But hard to say as we don't have good documentation for either one.
If Garkin says it's more complex, I'd trust that ZO_ScrollList is actually so complex that ZOS documented it for themselves ^^

This is the (complete) documentation for ZO_ScrollContainer:
--Scroll Control - Encapsulates a scroll control with a scrollbar
This for ZO_ScrollList:
--Scroll List Control
--A scrollable list of controls that reuses controls as they scroll out of view.
--Use this control when you have a very large number of a couple different types of controls to display.
--To use:
--(1) Add a scroll list to your XML.
--(2) Add data types to the scroll list, one for each type of control. A data type includes an XML control template, a height, and a callback that can setup the control given data.
--(3) Add data to the scroll list. First, use GetDataList to get the table holding the data. Next, use CreateDataEntry to create a list element of a certain data type. You may pass
-- in an arbitrary piece of data that will be given to the setup callback when the control is shown. Once you have made as many data entries as you need, add them to the data
-- list in any way you want. Finally, call Commit to update the scroll list with your data.
-- Note: The scroll list can use faster update logic if all controls are the same height.
function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)
--Adds a new control type for the list to handle. It must maintain a consistent size.
--@typeId - A unique identifier to give to CreateDataEntry when you want to add an element of this type.
--@templateName - The name of the virtual control template that will be used to hold this data
--@height - The control height
--@setupCallback - The function that will be called when a control of this type becomes visible. Signature: setupCallback(control, data)
--@dataTypeSelectSound - An optional sound to play when a row of this data type is selected.
--@resetControlCallback - An optional callback when the datatype control gets reset.
Turns out I had ZO_ScrollContainer in mind the whole time, that's the simple container you put controls in.

With ZO_ScrollList, you have to supply a row setup function and raw data, and it creates the required row controls as it needs them. I think a good example is Inventory window. If you have 100 items, it probably doesn't contain 100 rows, but only as many as are simultaneously visible, and fills them with item data as you scroll.
  Reply With Quote