Class: Toybox.WatchUi.TextArea

Overview

A representation of a text area that will automatically apply line breaks to fit as much text as possible.

See Also:

Example:

using Toybox.Graphics;
using Toybox.WatchUi;

class MyTextAreaView extends WatchUi.View {

    hidden var myTextArea;

    function initialize() {
        View.initialize();
    }

    function onShow() {
        myTextArea = new WatchUi.TextArea({
            :text=>"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
            :color=>Graphics.COLOR_WHITE,
            :font=>[Graphics.FONT_MEDIUM, Graphics.FONT_SMALL, Graphics.FONT_XTINY],
            :locX =>WatchUi.LAYOUT_HALIGN_CENTER,
            :locY=>WatchUi.LAYOUT_VALIGN_CENTER,
            :width=>160,
            :height=>160
        });
    }

    function onUpdate(dc) {
        dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
        dc.clear();
        myTextArea.draw(dc);
    }
}

Since:

API Level 3.1.0

Instance Method Summary collapse

Instance Method Details

draw(dc as Graphics.Dc) as Void

Draw Text to the device context (Dc).

Parameters:

Since:

API Level 3.1.0

initialize(options as { :text as Lang.String or Lang.ResourceId, :color as Graphics.ColorType, :backgroundColor as Graphics.ColorType, :font as Graphics.FontType or Lang.Array<Graphics.FontType>, :justification as Graphics.TextJustification or Lang.Number, :identifier as Lang.Object, :locX as Lang.Numeric, :locY as Lang.Numeric, :width as Lang.Numeric, :height as Lang.Numeric, :visible as Lang.Boolean })

Constructor

Parameters:

See Also:

Since:

API Level 3.1.0

setBackgroundColor(color as Graphics.ColorType) as Void

Set the background color of a Text object.

Parameters:

Since:

API Level 3.1.0

Throws:

setColor(color as Graphics.ColorType) as Void

Set the color of a Text object.

Parameters:

Since:

API Level 3.1.0

Throws:

setFont(font as Graphics.FontType or Lang.Array<Graphics.FontType>) as Void

Set the font face of a Text object.

Parameters:

See Also:

Since:

API Level 3.1.0

Throws:

setJustification(justification as Lang.Number) as Void

Set the justification of a Text object.

Parameters:

Since:

API Level 3.1.0

Throws:

setText(text as Lang.String or Lang.ResourceId) as Void

Set the text string of a Text object.

Parameters:

Since:

API Level 3.1.0

Throws:


Generated Dec 11, 2024, 8:58:44 AM