Class: Toybox::WatchUi::TextArea

Inherits:
Drawable show all

Overview

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

Examples:

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);
    }
}

See Also:

Since:

  • 3.1.0

Instance Attribute Summary

Attributes inherited from Drawable

height, identifier, locX, locY, width

Instance Method Summary collapse

Methods inherited from Drawable

setLocation, setSize

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(settings) ⇒ TextArea

Returns a new instance of TextArea

Parameters:

Options Hash (settings):

See Also:

Since:

  • 3.1.0


15786
15787
# File 'Monkeybrains.rb', line 15786

def initialize(settings)
end

Instance Method Details

draw(dc) ⇒ Object

Draw Text to the device context (Dc).

Parameters:

Since:

  • 3.1.0


15792
15793
# File 'Monkeybrains.rb', line 15792

def draw(dc)
end

setBackgroundColor(color) ⇒ Object

Set the background color of a Text object.

Parameters:

Since:

  • 3.1.0


15808
15809
# File 'Monkeybrains.rb', line 15808

def setBackgroundColor(color)
end

setColor(color) ⇒ Object

Set the color of a Text object.

Parameters:

Since:

  • 3.1.0


15800
15801
# File 'Monkeybrains.rb', line 15800

def setColor(color)
end

setFont(font) ⇒ Object

Set the font face of a Text object.

Parameters:

See Also:

Since:

  • 3.1.0


15818
15819
# File 'Monkeybrains.rb', line 15818

def setFont(font)
end

setJustification(justification) ⇒ Object

Set the justification of a Text object.

Parameters:

Since:

  • 3.1.0


15826
15827
# File 'Monkeybrains.rb', line 15826

def setJustification(justification)
end

setText(text) ⇒ Object

Set the text string of a Text object.

Parameters:

Since:

  • 3.1.0


15833
15834
# File 'Monkeybrains.rb', line 15833

def setText(text)
end