A themed, non-interactive text label. tone picks the theme text ramp (PRIMARY/SECONDARY/ TERTIARY) so theme swaps restyle it; colorOverride pins an explicit ARGB color instead. Set key (+ fallback) for localized text, or assign text directly.

Constructor

@:value({ tone : PRIMARY, size : 13, text : "" })new(text:String = "", size:Int = 13, tone:UITone = PRIMARY, ?align:TextFormatAlign)

Parameters:

text

the initial raw text

size

base font size (scaled by the theme)

tone

theme text ramp: 0 = primary, 1 = secondary, 2 = tertiary

align

paragraph alignment (default LEFT)

Variables

align:TextFormatAlign

@:value(0)colorOverride:Int = 0

Explicit ARGB color; overrides tone when != 0.

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

Fallback (and English source) for key.

@:value(null)key:String = null

Localization key; when set, render() resolves the text via UILocale.

size:Int

Base (unscaled) font size.

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

Raw text (used when key is null).

@:value(PRIMARY)tone:UITone = PRIMARY

PRIMARY = theme.text, SECONDARY = theme.text2, TERTIARY = theme.text3.

@:value(0)wrapWidth:Float = 0

When > 0, the label word-wraps to this width (multi-line); 0 keeps the single-line auto-size.

Methods

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

Switches the label to a localized string.

Parameters:

key

the translation key

fallback

the source-language text

measure():Float

Forces an immediate (re)layout so w/h are valid right now instead of on the next frame. Use before positioning sibling widgets below a wrapped label in a flow layout, where the deferred render would otherwise report a stale (often zero) height.

Returns:

the measured height

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(null)onClick:() ‑> Void = null

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

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

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

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

Fired on a right mouse press over this widget (context menus).

@: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

dispose():Void

Tears the widget down: listeners, pointer references, children, parent link.

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