A vertical scrolling custom grid widget for StableXUI.
- All grid items must be the same width and height
- Any StableXUI widget type can be added to the grid (not just buttons)
- Custom Widgets will add to the grid without issue
- Grid currently only supports vertical scrolling
//Create the grid var grid = new GridWidget(totalGridWidth, totalGridHeight, itemWidth, itemHeight);
//Create some test data for (i in 0...120) { //Add the widget to your grid grid.addWidget(new ru.stablex.ui.widgets.Button()); }
//redraw/organize the grid grid.refresh();
Lib.current.addChild(grid);
//This button will be in the first row and first column of the grid grid.addToStartOfGrid(new ru.stablex.ui.widgets.Button())
//This button will be in the last row and last column of the grid grid.addToEndOfGrid(new ru.stablex.ui.widgets.Button())
//This button will be in the mid row and first column of the grid grid.addToMiddleOfGrid(new ru.stablex.ui.widgets.Button())
//This button will be in the mid row and first column of the grid grid.removeWidget(new ru.stablex.ui.widgets.Button())
- Using
addWidget(x)
only adds the data to the data structure of the grid, it doesn't update the display.- Use this when adding multiple widgets, calling
grid.refresh()
afterwards to update the display only once.
- Use this when adding multiple widgets, calling
- Using
addToEndOfGrid(x)
,addToStartOfGrid(x)
,addToMidOfGrid(x)
orremoveWidget(x)
causes an immediate display update, meaning if you do this repeatedly performance will suffer...although you'll probably only notice it if your grid list has many items (> 100) or the grid items are complicated widgets.