The Label window element is the primary text-drawing element for the Interface. The text that a label displays must be set with the LabelSetText() function from Lua script. This is done because all text in the UI system is maintain as as a wide-string type. This allows us to support our foriegn language versions with just a single XML/Lua Source.
Label | The Label window element is the primary text-drawing element for the Interface. |
XML Definition | This is the Label xml definition. |
XML Tag | |
Required Attributes | Required for the window element to create itself properly. |
font | The name of the Font definition to use. |
Optional Attributes | These are optional. |
maxchars | The maximum number of characters allowed to be displayed. |
textalign | The text alignment. |
wordwrap | Should the text be word wrapped if the width of the text string. |
autoresize | Should the height of the label be automatically resized according to it’s text? |
autoresizewidth | Should the width be shrunk automatically to fit it’s text? |
textAutoFitMinScale | If the text min scale value is set to something other than 1.0, the Label will automatically drop the point size of the font on a non-re sizable label until the text fits within the label’s dimensions, up to th e min font scale. |
linespacing | An override value for the font line spacing. |
warnOnTextCropped | Should this Label log warning messages if the text is cut off? |
ignoreFormattingTags | Ignore all formatting tags while processing this text. |
Elements | |
Color | The color for the label’s text. |
LinkColor | The color for any links embedded in to the text. |
LinkHighlightColor | The mouse over color for any links embedded in to the text. |
Window Callbacks | These are the Label specific callback events. |
Callbacks | |
OnHyperLinkClicked | Called when a LButtonUP occurs over a hyper-link. |
OnHyperLinkMouseOver | Called when the mouse moves over a hyperlink. |
Functions | |
Functions | |
LabelSetText() | Sets the text currently displayed. |
LabelGetText() | Returns the text currently displayed. |
LabelSetTextColor() | Sets the color for the text display. |
LabelGetTextColor() | Returns the current text color for the display. |
LabelSetLinkColor() | Sets the link color for the text display. |
LabelGetLinkColor() | Returns the current hyper-link color for the display. |
LabelSetFont() | Sets the font for the text display |
LabelGetFont() | Returns the name of the font currently used. |
LabelGetTextDimensions() | Returns the the current text dimensions. |
LabelDumpGeometry() | This is a debugging function that renders the current text out to a texture. |
LabelSetWordWrap() | Turns on/off word wrapping |
LabelGetWordWrap() | Returns if word wrapping is enabled. |
LabelSetTextAlign() | Sets text alignment. |
This is the Label xml definition.
XML Tag | |
Required Attributes | Required for the window element to create itself properly. |
font | The name of the Font definition to use. |
Optional Attributes | These are optional. |
maxchars | The maximum number of characters allowed to be displayed. |
textalign | The text alignment. |
wordwrap | Should the text be word wrapped if the width of the text string. |
autoresize | Should the height of the label be automatically resized according to it’s text? |
autoresizewidth | Should the width be shrunk automatically to fit it’s text? |
textAutoFitMinScale | If the text min scale value is set to something other than 1.0, the Label will automatically drop the point size of the font on a non-re sizable label until the text fits within the label’s dimensions, up to th e min font scale. |
linespacing | An override value for the font line spacing. |
warnOnTextCropped | Should this Label log warning messages if the text is cut off? |
ignoreFormattingTags | Ignore all formatting tags while processing this text. |
Elements | |
Color | The color for the label’s text. |
LinkColor | The color for any links embedded in to the text. |
LinkHighlightColor | The mouse over color for any links embedded in to the text. |
The maximum number of characters allowed to be displayed.
The text alignment.
A string value, which is one of the following:
”left” | Aligned to the left. |
”top” | Centered horizontally. |
”center” | Centered horizontally (and vertically when autoresize is false). |
”right” | Aligned to the right. |
”leftcenter” | Aligned to the left and centered vertically. |
”rightcenter” | Aligned to the right and centered vertically. |
”bottom” | Aligned to the bottom and centered horizontaly |
”bottomleft” | Aligned to the bottom and left. |
”bottomright” | Aligned to the bottom and right. |
Should the text be word wrapped if the width of the text string. is greater than the Label width?
The word “true” or “false”
Should the height of the label be automatically resized according to it’s text?
The word “true” or “false”
Auto-resize is very useful for large blocks of text displayed in a scrolling or paging container, such as a ScrollWindow, HorizontalScrollWindow, or PageWindow.
Should the width be shrunk automatically to fit it’s text?
The word “true” or “false”
When auto-resizing the width of a label, the label will only size up to it’s specified dimensions. This attribute only reduces the size when the full width is not needed.
If the text min scale value is set to something other than 1.0, the Label will automatically drop the point size of the font on a non-re sizable label until the text fits within the label’s dimensions, up to th e min font scale.
An override value for the font line spacing.
Should this Label log warning messages if the text is cut off?
Ignore all formatting tags while processing this text. Setting this flag on labels you know will never use formatting tags can improve performance.
The color for the label’s text.
<Color r="255" g="255" b="255" />
r | The red color value |
g | The green color value |
b | The blue color value |
r | 255 |
g | 255 |
b | 255 |
The color for any links embedded in to the text.
<LinkColor r="255" g="255" b="255" />
r | The red color value |
g | The green color value |
b | The blue color value |
r | 0 |
g | 51 |
b | 255 |
The mouse over color for any links embedded in to the text.
<LinkHighlightColor r="255" g="255" b="255" />
r | The red color value |
g | The green color value |
b | The blue color value |
r | 167 |
g | 51 |
b | 255 |
These are the Label specific callback events.
Callbacks | |
OnHyperLinkClicked | Called when a LButtonUP occurs over a hyper-link. |
OnHyperLinkMouseOver | Called when the mouse moves over a hyperlink. |
Called when a LButtonUP occurs over a hyper-link.
SomeWindowName.OnHyperLinkClicked( linkParam )
linkParam | (wstring) The data that was embeded in the link tag from the text. |
Called when the mouse moves over a hyperlink.
SomeWindowName.OnHyperLinkMouseOver( linkParam )
linkParam | (wstring) The data that was embeded in the link tag from the text. |
Functions | |
LabelSetText() | Sets the text currently displayed. |
LabelGetText() | Returns the text currently displayed. |
LabelSetTextColor() | Sets the color for the text display. |
LabelGetTextColor() | Returns the current text color for the display. |
LabelSetLinkColor() | Sets the link color for the text display. |
LabelGetLinkColor() | Returns the current hyper-link color for the display. |
LabelSetFont() | Sets the font for the text display |
LabelGetFont() | Returns the name of the font currently used. |
LabelGetTextDimensions() | Returns the the current text dimensions. |
LabelDumpGeometry() | This is a debugging function that renders the current text out to a texture. |
LabelSetWordWrap() | Turns on/off word wrapping |
LabelGetWordWrap() | Returns if word wrapping is enabled. |
LabelSetTextAlign() | Sets text alignment. |
Sets the text currently displayed.
labelName | (string) The name of the label. |
text | (wstring) The text string. |
nil | no return value |
LabelSetText( "CharacterWindowName", GameData.Player.name )
Returns the text currently displayed.
labelName | (string) The name of the label. |
text | (wstring) The text string. |
local currText = LabelGetText( name )
Sets the color for the text display.
labelName | (string) The name of the label. |
red | (number) The red value for the text color (0-255) |
green | (number) The green value for the text color (0-255) |
blue | (number) The blue value for the text color (0-255) |
nil = no return value
LabelSetTextColor ("ChatWindowContainerChannelLabel", channel.color.r, channel.color.g, channel.color.b)
Returns the current text color for the display.
labelName | (string) The name of the label. |
red | (number) The red value for the text color (0-255) |
green | (number) The green value for the text color (0-255) |
blue | (number) The blue value for the text color (0-255) |
local r, g, b = LabelGetTextColor( "SomeLabel" )
Sets the link color for the text display.
labelName | (string) The name of the label. |
red | (number) The red value for the text color (0-255) |
green | (number) The green value for the text color (0-255) |
blue | (number) The blue value for the text color (0-255) |
nil = no return value
LabelSetLinkColor ("SomeWindow", color.r, color.g, color.b)
Returns the current hyper-link color for the display.
labelName | (string) The name of the label. |
red | (number) The red value for the hyper-link color (0-255) |
green | (number) The green value for the hyper-link color (0-255) |
blue | (number) The blue value for the hyper-link color (0-255) |
local r, g, b = LabelGetLinkColor( "SomeLabel" )
Sets the font for the text display
labelName | (string) The name of the label. |
fontName | (string) The name of the font to use. |
lineSpacing | (number) The line spacing value to use. |
nil = no return value
LabelSetFont( "DefaultTooltipRow"..rowNum.."Col"..colNum.."Text", "font_default_text", WindowUtils.FONT_DEFAULT_TEXT_LINESPACING )
Returns the name of the font currently used.
labelName | (string) The name of the label. |
fontName | (string) The name of the font. |
local fontName = LabelGetFont("SomeWindow")
Returns the the current text dimensions.
labelName | (string) The name of the label. |
x | (number) The width of the current text |
y | (number) The height of the current text |
local fontName = LabelGetFont("SomeWindow")
This is a debugging function that renders the current text out to a texture.
labelName | (string) The name of the label. |
nil | No return value. |
none
Turns on/off word wrapping
labelName | (string) The name of the label. |
wrapOn | (string) Is word wrapping enabled? True = yes, False = no. |
nil | No return value. |
none