View Single Post
07/23/14, 04:36 PM   #11
Sephiroth018
 
Sephiroth018's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 20
Originally Posted by zgrssd View Post
By the way, are there any Container controlls? Stack Pannels, Scroll Pannels, Grids, that kind of thing?
Right now I am just dropping the labels as children of the same level onto the Window. I prefer to have a proper visual tree.
Not really, there is just ZO_ScrollContainer, which provides vertical scrolling over all controls it contains. That requires you to have all controls created in it, one for every line you want to display (and, of course, properly positioned), which can easily lead to the damned "Too many anchors processed" error when creating many controls at once.

But before implementing such functionalities yourself, you could use the code I have written for my addon ItemSetGuide. I have made an helper that creates as much rows as are possible in it's parent and adds and handles a vertical scrollbar all by itself:
Lua Code:
  1. function libDwemerAssistants.CreateScrollControl(container, headerRow, createRowFunction, rowDataUpdateFunction, initialData)
  • container: is the parent container where the controls should be created and displayed
  • headerRow: is optional and just places the given control in the container, using it as header
  • createRowFunction: provides a function to create an empty row control for initialization and must return the empty row control and take the following arguments:
    • container: the parent container again
    • index: The number of the created control, starting with 1
  • rowDataUpdateFunction: A function that is called when another element has to be displayed in a row, requires the following arguments:
    • row: the row control that needs to be updated
  • initialData: optional, the data that should be set after creation

The container gets the following fields:
  • rows: A table containing all displayed rows
  • numberOfRows: The number of rows displayed at once, just to help me so I don't have to always count the elements in "rows" when needing that value.
  • setNewDataFunction: A function for replacing the current data table with a new one, including setting the scrollbar back to the top and displaying the first x elements of the new data table. Takes the following arguments:
    • control: The container itself
    • data: The data table containing the new data
  • currentData: The table containing all data that should be displayed
  • currentDataRow: The index of the element that is currently the first one

The row control gets the following fields:
  • rowData: The element displayed in that row
  • rowDataUpdateFunction: The function passed to libDwemerAssistants.CreateScrollControl to update the row

I know it could be better, but it's a start
I plan to make this available as a library here on esoui as soon as I am happy with the implementation.
  Reply With Quote