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


15708
15709
# File 'Monkeybrains.rb', line 15708

def initialize(settings)
end

Instance Method Details

draw(dc) ⇒ Object

Draw Text to the device context (Dc).

Parameters:

Since:

  • 1.0.0


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

def draw(dc)
end

setBackgroundColor(color) ⇒ Object

Set the background color of a Text object.

Parameters:

Since:

  • 1.3.0


15730
15731
# File 'Monkeybrains.rb', line 15730

def setBackgroundColor(color)
end

setColor(color) ⇒ Object

Set the color of a Text object.

Parameters:

Since:

  • 1.0.0


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

def setColor(color)
end

setFont(font) ⇒ Object

Set the font face of a Text object.

Parameters:

See Also:

Since:

  • 1.0.0


15740
15741
# File 'Monkeybrains.rb', line 15740

def setFont(font)
end

setJustification(justification) ⇒ Object

Set the justification of a Text object.

Parameters:

Since:

  • 1.0.0


15748
15749
# File 'Monkeybrains.rb', line 15748

def setJustification(justification)
end

setText(text) ⇒ Object

Set the text string of a Text object.

Parameters:

Since:

  • 1.0.0


15755
15756
# File 'Monkeybrains.rb', line 15755

def setText(text)
end