Label

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.

Summary
LabelThe Label window element is the primary text-drawing element for the Interface.
XML DefinitionThis is the Label xml definition.
XML Tag
Required AttributesRequired for the window element to create itself properly.
fontThe name of the Font definition to use.
Optional AttributesThese are optional.
maxcharsThe maximum number of characters allowed to be displayed.
textalignThe text alignment.
wordwrapShould the text be word wrapped if the width of the text string.
autoresizeShould the height of the label be automatically resized according to it’s text?
autoresizewidthShould the width be shrunk automatically to fit it’s text?
textAutoFitMinScaleIf 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.
linespacingAn override value for the font line spacing.
warnOnTextCroppedShould this Label log warning messages if the text is cut off?
ignoreFormattingTagsIgnore all formatting tags while processing this text.
Elements
ColorThe color for the label’s text.
LinkColorThe color for any links embedded in to the text.
LinkHighlightColorThe mouse over color for any links embedded in to the text.
Window CallbacksThese are the Label specific callback events.
Callbacks
OnHyperLinkClickedCalled when a LButtonUP occurs over a hyper-link.
OnHyperLinkMouseOverCalled 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.

XML Definition

This is the Label xml definition.

Summary
XML Tag
Required AttributesRequired for the window element to create itself properly.
fontThe name of the Font definition to use.
Optional AttributesThese are optional.
maxcharsThe maximum number of characters allowed to be displayed.
textalignThe text alignment.
wordwrapShould the text be word wrapped if the width of the text string.
autoresizeShould the height of the label be automatically resized according to it’s text?
autoresizewidthShould the width be shrunk automatically to fit it’s text?
textAutoFitMinScaleIf 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.
linespacingAn override value for the font line spacing.
warnOnTextCroppedShould this Label log warning messages if the text is cut off?
ignoreFormattingTagsIgnore all formatting tags while processing this text.
Elements
ColorThe color for the label’s text.
LinkColorThe color for any links embedded in to the text.
LinkHighlightColorThe mouse over color for any links embedded in to the text.

XML Tag

<Label>
....
</Label>

Required Attributes

Required for the window element to create itself properly.

font

The name of the Font definition to use.

Expects

  • A string value of a valid Font.

Optional Attributes

These are optional.  You can use whichever apply to the label you are creating.

maxchars

The maximum number of characters allowed to be displayed.

Expects

  • A number greater than 0.

Default Value

  • 255

textalign

The text alignment.

Expects

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.

Default Value

  • ”left”

wordwrap

Should the text be word wrapped if the width of the text string. is greater than the Label width?

Expects

The word “true” or “false”

  • true: Yes, allow word wrapping if needed.
  • false: No, cut off the text if it reaches the max width.

Default Value

  • ”false”

autoresize

Should the height of the label be automatically resized according to it’s text?

Expects

The word “true” or “false”

  • true: Yes, size the label to fit it’s text.
  • false: No, cut off the text if it reaches the max height.

Default Value

  • ”false”

Notes

Auto-resize is very useful for large blocks of text displayed in a scrolling or paging container, such as a ScrollWindow, HorizontalScrollWindow, or PageWindow.

autoresizewidth

Should the width be shrunk automatically to fit it’s text?

Expects

The word “true” or “false”

  • true: Yes, reduce the width of the label to fit it’s text.
  • false: No, never reduce the width of the label.

Default Value

  • ”false”

Notes

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.

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.

Expects

  • A number value.  (1.0 = 100% and no auto-scaling)

Default Value

  • 1.0

linespacing

An override value for the font line spacing.

Expects

  • A number.  If 0, the font height is used.

Default Value

  • 0

warnOnTextCropped

Should this Label log warning messages if the text is cut off?

Expects

  • true: Yes, log error messages when the text is cut off.
  • false: No, do not log error messages when the text is cut off.

Default Value

  • true

ignoreFormattingTags

Ignore all formatting tags while processing this text.  Setting this flag on labels you know will never use formatting tags can improve performance.

Expects

  • true: Yes, do not process formatting tags.
  • false: No, handle all formatting tags appropriately.

Default Value

  • false

Elements

Color

The color for the label’s text.

Syntax

<Color r="255" g="255" b="255"  />
rThe red color value
gThe green color value
bThe blue color value

Defaults

r255
g255
b255

LinkColor

The color for any links embedded in to the text.

Syntax

<LinkColor r="255" g="255" b="255"  />
rThe red color value
gThe green color value
bThe blue color value

Defaults

r0
g51
b255

LinkHighlightColor

The mouse over color for any links embedded in to the text.

Syntax

<LinkHighlightColor r="255" g="255" b="255"  />
rThe red color value
gThe green color value
bThe blue color value

Defaults

r167
g51
b255

Window Callbacks

These are the Label specific callback events.

Summary
Callbacks
OnHyperLinkClickedCalled when a LButtonUP occurs over a hyper-link.
OnHyperLinkMouseOverCalled when the mouse moves over a hyperlink.

Callbacks

OnHyperLinkClicked

Called when a LButtonUP occurs over a hyper-link.

Syntax

SomeWindowName.OnHyperLinkClicked( linkParam )
linkParam(wstring) The data that was embeded in the link tag from the text.

OnHyperLinkMouseOver

Called when the mouse moves over a hyperlink.

Syntax

SomeWindowName.OnHyperLinkMouseOver( linkParam )
linkParam(wstring) The data that was embeded in the link tag from the text.

Functions

Summary
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.

Functions

LabelSetText()

Sets the text currently displayed.

Parameters

labelName(string) The name of the label.
text(wstring) The text string.

Returns

nilno return value

Notes

  • none

Example

LabelSetText( "CharacterWindowName", GameData.Player.name )

LabelGetText()

Returns the text currently displayed.

Parameters

labelName(string) The name of the label.

Returns

text(wstring) The text string.

Notes

  • none

Example

local currText = LabelGetText( name )

LabelSetTextColor()

Sets the color for the text display.

Parameters

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)

Returns

nil = no return value

Notes

  • none

Example

LabelSetTextColor ("ChatWindowContainerChannelLabel", channel.color.r, channel.color.g, channel.color.b)

LabelGetTextColor()

Returns the current text color for the display.

Parameters

labelName(string) The name of the label.

Returns

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)

Notes

  • none

Example

local r, g, b = LabelGetTextColor( "SomeLabel" )

LabelSetLinkColor()

Sets the link color for the text display.

Parameters

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)

Returns

nil = no return value

Notes

  • none

Example

LabelSetLinkColor ("SomeWindow", color.r, color.g, color.b)

LabelGetLinkColor()

Returns the current hyper-link color for the display.

Parameters

labelName(string) The name of the label.

Returns

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)

Notes

  • none

Example

local r, g, b = LabelGetLinkColor( "SomeLabel" )

LabelSetFont()

Sets the font for the text display

Parameters

labelName(string) The name of the label.
fontName(string) The name of the font to use.
lineSpacing(number) The line spacing value to use.

Returns

nil = no return value

Related XML

Notes

  • none

Example

LabelSetFont( "DefaultTooltipRow"..rowNum.."Col"..colNum.."Text", "font_default_text", WindowUtils.FONT_DEFAULT_TEXT_LINESPACING )

LabelGetFont()

Returns the name of the font currently used.

Parameters

labelName(string) The name of the label.

Returns

fontName(string) The name of the font.

Related XML

Notes

  • none

Example

local fontName = LabelGetFont("SomeWindow")

LabelGetTextDimensions()

Returns the the current text dimensions.

Parameters

labelName(string) The name of the label.

Returns

x(number) The width of the current text
y(number) The height of the current text

Notes

  • This call is very usefully for manually resizing window to fit their data.

Example

local fontName = LabelGetFont("SomeWindow")

LabelDumpGeometry()

This is a debugging function that renders the current text out to a texture.

Parameters

labelName(string) The name of the label.

Returns

nilNo return value.

Notes

  • none

Example

none

LabelSetWordWrap()

Turns on/off word wrapping

Parameters

labelName(string) The name of the label.
wrapOn(string) Is word wrapping enabled?  True = yes, False = no.

Returns

nilNo return value.

Related XML

Notes

  • none

Example

none

LabelGetWordWrap()

Returns if word wrapping is enabled.

Parameters

labelName(string) The name of the label.

Returns

wrapOn(string) Is word wrapping enabled?  True = yes, False = no.

Related XML

Notes

  • none

Example

none

LabelSetTextAlign()

Sets text alignment.

Parameters

labelName(string) The name of the label.
textAlign(string) The alignment setting.

Returns

nilNo return value.

Notes

  • none

Example

none

This element defines a font defintion.
Sets the text currently displayed.
Should the height of the label be automatically resized according to it’s text?
The ScrollWindow is a container window that provides a vertical scrolling panel for all of it’s child windows.
The HorizontalScrollWindow is a container window that provides a horizontal scrolling panel for all of it’s child windows.
The PageWindow provides an automated display for creating a book-like layout.
The name of the Font definition to use.
Should the text be word wrapped if the width of the text string.