Class: Toybox::WatchUi::ProgressBar

Inherits:
Lang::Object show all

Overview

Note:

The look and feel of a progress bar is device-specific.

A representation of an on-screen progress bar.

A ProgressBar is a special View that presents the user with a progress indicator. These can display a string and either an incremental progress bar from 0-100% or a “busy” indicator. A ProgressBar is pushed using pushView(), which provides either null or a BehaviorDelegate. If a BehaviorDelegate is provided, the onBack() method will be called if Back button is pressed while the ProgressBar is displayed.

Examples:

Create a simple busy progress indicator

using Toybox.WatchUi;

class MyProgressDelegate extends Ui.BehaviorDelegate {
    function initialize() {
        BehaviorDelegate.initialize();
    }

    function onBack() {
        return true;
    }
}

class MyBehaviorDelegate extends Ui.BehaviorDelegate {
    var progressBar;

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

    function onSelect() {
        progressBar = new WatchUi.ProgressBar(
            "Processing...",
            null
        );
        Ui.pushView(
            progressBar,
            new MyProgressDelegate(),
            Ui.SLIDE_DOWN
        );
        return true;
    }
}

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(displayString, startValue) ⇒ ProgressBar

Returns a new instance of ProgressBar

Parameters:

  • displayString (Toybox::Lang::String)

    The string to display on the ProgressBar

  • startValue (Toybox::Lang::Float)

    The initial value for the ProgressBar:

    • An increment from 0 to 100

    • null for “busy”

Since:

  • 1.0.0


13809
13810
# File 'Monkeybrains.rb', line 13809

def initialize(displayString, startValue)
end

Instance Method Details

setDisplayString(displayString) ⇒ Object

Set the string to display on the ProgressBar.

Parameters:

Since:

  • 1.0.0


13825
13826
# File 'Monkeybrains.rb', line 13825

def setDisplayString(displayString)
end

setProgress(progressValue) ⇒ Object

Set the value of the ProgressBar.

Parameters:

  • progressValue (Toybox::Lang::Float)

    The current value of the ProgressBar:

    • An increment from 0 to 100

    • null for “busy”

Since:

  • 1.0.0


13818
13819
# File 'Monkeybrains.rb', line 13818

def setProgress(progressValue)
end