Class: Toybox::WatchUi::Text

Inherits:
Drawable show all

Overview

A representation of a text resource.

Examples:

using Toybox.Graphics;
using Toybox.WatchUi;

class MyTextView extends WatchUi.View {

    hidden var myText;

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

    function onShow() {
        myText = new WatchUi.Text({
            :text=>"Hello World!",
            :color=>Graphics.COLOR_WHITE,
            :font=>Graphics.FONT_LARGE,
            :locX =>WatchUi.LAYOUT_HALIGN_CENTER,
            :locY=>WatchUi.LAYOUT_VALIGN_CENTER
        });
    }

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

See Also:

Since:

  • 1.0.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) ⇒ Text

Returns a new instance of Text

Parameters:

Options Hash (settings):

See Also:

Since:

  • 1.0.0


15681
15682
# File 'Monkeybrains.rb', line 15681

def initialize(settings)
end

Instance Method Details

draw(dc) ⇒ Object

Draw Text to the device context (Dc).

Parameters:

Since:

  • 1.0.0


15687
15688
# File 'Monkeybrains.rb', line 15687

def draw(dc)
end

setBackgroundColor(color) ⇒ Object

Set the background color of a Text object.

Parameters:

Since:

  • 1.3.0


15703
15704
# File 'Monkeybrains.rb', line 15703

def setBackgroundColor(color)
end

setColor(color) ⇒ Object

Set the color of a Text object.

Parameters:

Since:

  • 1.0.0


15695
15696
# File 'Monkeybrains.rb', line 15695

def setColor(color)
end

setFont(font) ⇒ Object

Set the font face of a Text object.

Parameters:

See Also:

Since:

  • 1.0.0


15713
15714
# File 'Monkeybrains.rb', line 15713

def setFont(font)
end

setJustification(justification) ⇒ Object

Set the justification of a Text object.

Parameters:

Since:

  • 1.0.0


15721
15722
# File 'Monkeybrains.rb', line 15721

def setJustification(justification)
end

setText(text) ⇒ Object

Set the text string of a Text object.

Parameters:

Since:

  • 1.0.0


15728
15729
# File 'Monkeybrains.rb', line 15728

def setText(text)
end