A virtualized, selectable list. Only the visible rows (+2) exist as display objects; they are recycled by modulo slot mapping, so scrolling by one row rebinds exactly one row and a 100k-entry list costs the same as a 20-entry one. Rows are fixed-height (the constraint that keeps the window math O(1)).
Data is provider-driven: setProvider(count, label) for huge/lazy datasets or
setItems(array) for convenience. Custom row content subclasses UIListRow and overrides
bind(), supplied through rowFactory.
Input: mouse wheel + scrollbar thumb drag everywhere; on mobile (touchScroll) dragging
anywhere scrolls with fling momentum — a drag past the threshold steals the press so no
row click fires. Clicking focuses the list; Up/Down move the selection, Enter fires
onActivate (as does a double click).
Constructor
new(width:Float, height:Float, rowHeight:Float = 0)
Parameters:
width | layout width (the scrollbar lives inside it) |
|---|---|
height | the visible viewport height |
rowHeight | base (unscaled) row height; 0 picks the platform default |
Variables
rowFactory:UIList ‑> UIListRow = null
Creates one pooled row; null uses the default single-label UIListRow.
Methods
inlinelabelOf(index:Int):String
The display label for an index (used by the default row's bind).
Parameters:
index | the entry index |
|---|
Returns:
the label ("" without a provider)
refresh():Void
Rebinds every visible row in place (call after mutating the underlying data without changing the count).
scrollTo(index:Int):Void
Scrolls the minimum distance to bring an index fully into view.
Parameters:
index | the entry to reveal |
|---|
select(index:Int, reveal:Bool = false):Void
Programmatically selects an index without firing onSelect.
Parameters:
index | the entry to select, or -1 to clear |
|---|---|
reveal |
|
inlinesetItems(items:Array<String>):Void
Convenience data source from an array (see setProvider).
Parameters:
items | the row labels |
|---|
setProvider(count:Int, label:Int ‑> String):Void
Sets the data source (row labels resolved lazily; nothing is built up front). Clamps the selection and scroll, then rebinds the visible window.
Parameters:
count | the total number of entries |
|---|---|
label | resolves the display label for an index |
setScroll(value:Float):Void
Scrolls to an absolute offset (clamped) and rebinds the visible window.
Parameters:
value | the target offset in pixels |
|---|