Class: Toybox::WatchUi::Text

Inherits:
Drawable show all

Overview

A representation of a text resource.

Examples:

using Toybox.Graphics;
using Toybox.WatchUi;

class MyStringView extends WatchUi.View {

    var myString = "";

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

    function onShow() {
        myString = 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) {
        myString.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


14302
14303
# File 'Monkeybrains.rb', line 14302

def initialize(settings)
end

Instance Method Details

draw(dc) ⇒ Object

Draw Text to the device context (Dc).

Parameters:

Since:

  • 1.0.0


14308
14309
# File 'Monkeybrains.rb', line 14308

def draw(dc)
end

setBackgroundColor(color) ⇒ Object

Set the background color of a Text object. Graphics.COLOR_* value

representing the desired background color

Parameters:

Since:

  • 1.3.0


14324
14325
# File 'Monkeybrains.rb', line 14324

def setBackgroundColor(color)
end

setColor(color) ⇒ Object

Set the color of a Text object. Graphics.COLOR_* value

representing the desired text color

Parameters:

Since:

  • 1.0.0


14316
14317
# File 'Monkeybrains.rb', line 14316

def setColor(color)
end

setFont(font) ⇒ Object

Set the font face of a Text object.

Parameters:

See Also:

Since:

  • 1.0.0


14334
14335
# File 'Monkeybrains.rb', line 14334

def setFont(font)
end

setJustification(justification) ⇒ Object

Set the justification of a Text object.

Parameters:

Since:

  • 1.0.0


14342
14343
# File 'Monkeybrains.rb', line 14342

def setJustification(justification)
end

setText(text) ⇒ Object

Set the text string of a Text object.

Parameters:

Since:

  • 1.0.0


14349
14350
# File 'Monkeybrains.rb', line 14349

def setText(text)
end