Appearance
Label
Displays text and optionally an icon, sizing its height dynamically to fit the content.
Create with AceGUI:Create("Label"). It inherits the Common Widget API.
Widget type: Label
Methods
SetText
method#
lua
widget:SetText(text?)Sets the label's text and re-lays out the text/image anchors.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
text (optional) | string | The text to display. Passing nil clears it; zero-height labels are forced to 1px so they can serve as spacers. |
SetColor
method#
lua
widget:SetColor(r?, g?, b?)Sets the vertex color of the label text. If any component is missing, the color defaults to white (1, 1, 1).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
r (optional) | number | Red component in the range 0–1. Defaults to white (1, 1, 1) if any component is missing. | |
g (optional) | number | Green component in the range 0–1. | |
b (optional) | number | Blue component in the range 0–1. |
SetImage
method#
lua
widget:SetImage(path?, ...)Sets an optional image displayed alongside the text. When set, the image appears on the left if there is at least 200px of room for the text; otherwise it is centered on top. Passing a nil or invalid texture hides the image.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
path (optional) | string | number | Texture path or file ID, or nil to remove the image. | |
... | number | Optional texture coordinates: either 4 (left, right, top, bottom) or 8 values. Any other count falls back to the full texture. |
SetImageSize
method#
lua
widget:SetImageSize(width, height)Sets the displayed size of the image and re-lays out the widget.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
width | number | Image width in pixels. | |
height | number | Image height in pixels. |
SetFont
method#
lua
widget:SetFont(font, height, flags)Sets the label font using an internal, lazily-created font object.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
font | string | Font file path. | |
height | number | Font height in pixels. | |
flags | string | Font flags string (e.g. "OUTLINE"). |
SetFontObject
method#
lua
widget:SetFontObject(font?)Sets the label's font from an existing font object. Defaults to GameFontHighlightSmall when nil.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
font (optional) | table | A font object, or nil for the default (GameFontHighlightSmall). |
SetJustifyH
method#
lua
widget:SetJustifyH(justifyH)Sets horizontal text justification.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
justifyH | string | "LEFT", "CENTER", or "RIGHT". |
SetJustifyV
method#
lua
widget:SetJustifyV(justifyV)Sets vertical text justification.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
justifyV | string | "TOP", "MIDDLE", or "BOTTOM". |
OnWidthSet
method#
lua
widget:OnWidthSet(width)Layout hook called by AceGUI when the width changes; re-anchors the text and image. Not normally called directly.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
width | number | The new width. |
Defaults
On acquire the label resets to: width 200, empty text, no image, image size 16×16, white color, default font object, horizontal justify LEFT, and vertical justify TOP. Height is always derived from the text and image.
Callbacks
This widget fires no widget-specific callbacks.
Example
lua
local label = AceGUI:Create("Label")
label:SetText("Status: ready")
label:SetColor(0, 1, 0)
label:SetImage("Interface\\Icons\\INV_Misc_QuestionMark")
label:SetImageSize(20, 20)