A virtualized icon/tile grid: fixed-size tiles that reflow into as many columns as the width allows, scrolled vertically. Like UIList only the on-screen tiles (+ two rows) exist as display objects and are recycled by slot mapping, so a grid of any size is cheap.

Data is provider-driven (setProvider / setItems); the default tile draws an optional glyph over a centered label. Custom tiles subclass UITile and override bind(), supplied through tileFactory. Input mirrors UIList: wheel + thumb drag everywhere, touch drag with fling on mobile, arrow-key navigation, Enter/double-click to activate.

Constructor

new(width:Float, height:Float)

Parameters:

width

layout width

height

visible viewport height

Variables

@:value(10)gapBase:Float = 10

Base (unscaled) gap between tiles.

@:value(0)read onlyitemCount:Int = 0

Total data entries.

read onlymaxScroll:Float

The furthest scrollY can go.

@:value(12)padBase:Float = 12

Base (unscaled) padding around the grid.

@:value(0)read onlyscrollY:Float = 0

Current scroll offset in pixels.

@:value(-1)read onlyselectedIndex:Int = -1

The selected tile index, or -1.

@:value(84)tileHeightBase:Float = 84

Base (unscaled) tile height.

@:value(92)tileWidthBase:Float = 92

Base (unscaled) tile width.

@:value(false)touchScroll:Bool = false

Drag-anywhere scrolling with fling momentum (default on for mobile).

@:value(48)wheelStep:Float = 48

Pixels per wheel notch.

@:value(null)onActivate:Int ‑> Void = null

Fired on double click / Enter.

@:value(null)onSelect:Int ‑> Void = null

Fired when the selection changes.

@:value(null)tileFactory:UITileGrid ‑> UITile = null

Creates one pooled tile; null uses the default glyph+label UITile.

Methods

inlineglyphOf(index:Int):UIGlyph

The glyph for an index, or -1 for none (used by the default tile).

inlinelabelOf(index:Int):String

The label for an index (used by the default tile).

onKeyDown(keyCode:Int, charCode:Int, ctrl:Bool, shift:Bool, alt:Bool):Bool

refresh():Void

Rebinds every visible tile in place (after mutating data without changing the count).

scrollTo(index:Int):Void

Scrolls the minimum distance to bring an index's row into view.

Parameters:

index

the entry to reveal

@:value({ reveal : false })select(index:Int, reveal:Bool = false):Void

Selects an index without firing onSelect.

Parameters:

index

the entry to select, or -1 to clear

reveal

true also scrolls the tile into view

inlinesetItems(items:Array<String>):Void

Convenience data source from an array of labels (see setProvider).

Parameters:

items

the tile labels

setProvider(count:Int, label:Int ‑> String, ?glyph:Int ‑> UIGlyph, ?tint:Int ‑> Int):Void

Sets the data source (tiles resolved lazily).

Parameters:

count

the total number of entries

label

resolves a tile's label for an index

glyph

optional glyph id for an index (null for none)

tint

optional glyph colour for an index (null uses the theme accent)

setScroll(value:Float):Void

Scrolls to an absolute offset (clamped) and rebinds the visible window.

Parameters:

value

the target offset in pixels

inlinetintOf(index:Int):Int

The glyph tint for an index, or the theme accent (used by the default tile).

Inherited Variables

Defined by UIComponent

@:value(true)enabled:Bool = true

Disabled widgets ignore the pointer and typically render dimmed.

@:value(0)read onlyh:Float = 0

Layout height in UI units.

@:value(MouseCursor.BUTTON)hoverCursor:MouseCursor = MouseCursor.BUTTON

Native cursor while hovering (interactive widgets; null keeps the arrow).

@:value(false)read onlyhovered:Bool = false

true while the cursor is over this widget.

@:value(false)longPressable:Bool = false

Opts a subclass that overrides onRightPress (without setting onRightClick) into long-press-as-right-click on touch. Widgets with onRightClick set are included automatically.

@:value(null)onClick:() ‑> Void = null

Fired on a completed click (press + release on this widget). Requires an interactive widget.

@:value(null)onHover:() ‑> Void = null

Fired when the cursor first enters this widget (hover-driven descriptions/previews). Interactive widgets only.

@:value(null)onRightClick:() ‑> Void = null

Fired on a right mouse press over this widget (context menus). Only interactive widgets receive pointer events, so this never fires on passive widgets like UILabel/UIPanel — attach it to a UIButton (or another interactive widget) instead. On touch, a long-press fires the same path (see UIRoot.longPressMs).

@:value(false)read onlypressed:Bool = false

true while a press that started here is held.

@:value(null)tooltip:String = null

Optional tooltip text (already-localized or a fixed string).

@:value(null)tooltipShortcut:String = null

Optional right-aligned shortcut hint rendered in the tooltip.

@:value(0)read onlyw:Float = 0

Layout width in UI units (independent of DisplayObject's content-derived width).

Inherited Methods

Defined by UIComponent

invalidate():Void

Schedules a repaint for the next frame (cheap; deduplicated).

resize(width:Float, height:Float):Void

Sets the layout size and repaints when it changed.

Parameters:

width

the new layout width in UI units

height

the new layout height in UI units