Label

Extends LabelBase

As of Roku OS 10.5, the Label node inherits most of its functionality from LabelBase node class. Developers, however, do not need to update their app code to account for this refactoring.

The Label node class is used to display a string of text.

Example

The following example shows a text layout derived from the Label node.

roku815px - label-node-sample

The following displays the text string "Application Development Made Easy!" in the medium bold system font near the left top of the display screen.

<?xml version="1.0" encoding="utf-8" ?>

<!--********** Copyright 2015 Roku Corp.  All Rights Reserved. **********-->

<component name="labeltest" extends="Group" >

<script type="text/brightscript" >
<![CDATA[

  sub init()
    m.top.setFocus(true)
  end sub

]]>
</script>

<Label
  id="testLabel"
  height="44"
  width="0"
  font="font:MediumBoldSystemFont"
  text = "Application Development Made Easy!"
  horizAlign = "left"
  vertAlign = "center"
  translation="[318,8]" />

</component>

Fields

Fields derived from the Group and LabelBase classes can be used.

FieldTypeDefaultAccess PermissionDescription
fontFontsystem defaultREAD_WRITESpecifies the Font node to be used
lineSpacingfloatREAD_WRITEIf the text is displayed on more than one line, specifies the amount of additional space added between lines
truncateOnDelimiterstringREAD_WRITEIf the width field value is greater than zero, provides a set of characters that are used to determine how to truncate the last line of text that is displayed if it extends beyond the specified width. If none of the characters in the last line of text are included in the truncateOnDelimiter field value string, the entire last line is not displayed. When the value is set to a non-empty string, the ellipsizeOnBoundary field value is ignored
leadingEllipsisbooleanfalseREAD_WRITESpecifies whether to display the end or beginning of text that overflows its available width:
  • true. The end of the text is shown. For example, "the quick brown fox jumps over the lazy dog" would be truncated to "...jumps over the lazy dog".
  • false. The start of the text is shown (for example, "the quick brown fox jumps...").
wrappedLinesIntegerREAD_ONLYindicates the number of wrapped lines in the label.

Sample app

You can download and install a sample app that demonstrates how to use the Label node.