ControlLabel

Package: Libraries.Interface.Controls · Inherits from: Libraries.Game.Graphics.Label, Libraries.Interface.Item, Libraries.Interface.Controls.Control, Libraries.Interface.Item2D, Libraries.Language.Object

The ControlLabel class is a Label used inside other controls, such as the items of a list or a tree. It changes its font color when it is selected, using the selection font color while its container has the focus and the unfocused selection font color when it doesn't. It is not placed on its base line, so letters that hang down stay inside its area.

Example Code

use Libraries.Interface.Forms.Form
use Libraries.Interface.Forms.Page
use Libraries.Interface.Controls.Tree
use Libraries.Interface.Controls.TreeItem

Form form
Page page = form:GetMainPage()
Tree tree = page:AddTree("Files")

// The name on each row is drawn by a ControlLabel, which
// changes its color when the row is selected.
TreeItem item
item:SetName("Main.quorum")
tree:Add(item)
item:Select()

form:Display()

Actions

GainedSelection()

This action is called when the label becomes the selected item while its container has the focus. The label draws its text in the selection font color and shows its focus.

IsRenderingFocus()

This action returns whether the label shows its focus. This is true after GainedSelection and false after UnfocusedSelection or LostSelection.

Returns

boolean: True if the label shows its focus.

IsRenderingSelection()

This action returns whether the label is drawn as selected.

Returns

boolean: True if the label is drawn in a selection color.

LoadGraphics(Libraries.Interface.Layouts.LayoutProperties properties)

This action loads the graphics for the label. After the text is loaded, the label uses the view from the properties when they have one. If not, and the label has no view yet, it gets a ControlShaderView, which draws its background and border. The game engine calls this as needed, so most users won't need to call it directly.

Parameters

LostSelection()

This action is called when the label stops being selected. The label goes back to drawing its text in its normal font color.

UnfocusedSelection()

This action is called when the label is selected but its container doesn't have the focus. The label draws its text in the unfocused selection font color, if one is set, and doesn't show its focus.

Inherited Actions

55 actions from Libraries.Game.Graphics.Label
250 actions from Libraries.Interface.Controls.Control
59 actions from Libraries.Interface.Item
195 actions from Libraries.Interface.Item2D
3 actions from Libraries.Language.Object