A labelled dropdown row: label left, value box right. Clicking the box opens a scrollable popup list on UIRoot.popupLayer behind a click-blocking backdrop, so nothing underneath can be interacted with while it is open (Escape or an outside click closes it). display entries override row labels while items holds the raw values delivered to onSelect.

Set searchable for combo-box type-ahead: while the popup is open, typing filters the list (case-insensitive substring on the shown labels), Backspace edits the query, and Enter picks the first match. A search header at the top of the popup shows the query.

Constructor

new(label:String, width:Float, ?onSelect:(index:Int, value:String) ‑> Void)

Parameters:

label

the row text on the left

width

layout width (the value box sits at the right edge)

onSelect

fired when the user picks an entry

Variables

controlWidth:Float

Width of the value box on the right; the label uses the remaining row width.

@:value("")fallback:String = ""

@:value(12)fontSize:Int = 12

@:value(null)key:String = null

label:String

@:value(10)maxRows:Int = 10

Max visible rows before the popup scrolls.

@:value(false)searchable:Bool = false

Combo-box type-ahead: while open, typing filters the popup and Enter picks the first match.

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

read onlyselectedValue:String

The raw value of the current selection ("" when empty).

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

Methods

closePopup():Void

Closes the popup list (no selection change).

localize(key:String, fallback:String):Void

Switches the label to a localized string.

Parameters:

key

the translation key

fallback

the source-language text

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

select(index:Int):Void

Programmatically selects an index without firing onSelect.

Parameters:

index

the entry to select (ignored when out of range)

setItems(items:Array<String>, ?display:Array<String>):Void

Sets the entries, keeping the selection when possible.

Parameters:

items

the raw values delivered to onSelect

display

optional per-entry labels shown instead of the raw values

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