Getting Started - Text Widget

A quick introduction to the Text widget.

Overview

Create a basic Text widget

dUI = require 'dmc_ui'

-- the widget text can be set in constructor

widget = dUI.newText{
    text="Wonderful"
}

-- or by using property 'text'

widget.text="World"

Adding local style to a Text widget

dUI = require 'dmc_ui'

text = dUI.newText{
    text="my text",

    style={
        align='left',
        font=native.systemFont,
        fontSize=16,
        marginX=10,
        marginY=5,
        textColor={0,0,0,1},
    }
}

Properties

text.width can be set. This will constrain the widget to that dimension. If the text can't fit within that width, then ellipses will be shown, eg (...).

text.height can be set. That changes the height of the widget, but it does not change the height of the Text Component inside of the widget.

All of the Text Widget properties can be seen in the API References.

References