Class: Toybox.WatchUi.ProgressBar

Overview

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.

Note:

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

Example:

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:

API Level 1.0.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

initialize(displayString as Lang.String, startValue as Lang.Float or Null)

Constructor

Parameters:

  • displayString(Lang.String)

    The string to display on the ProgressBar

  • startValue(Lang.Float)

    The initial value for the ProgressBar:

    • An increment from 0 to 100

    • null for "busy"

Since:

API Level 1.0.0

setDisplayString(displayString as Lang.String) as Void

Set the string to display on the ProgressBar.

Parameters:

  • displayString(Lang.String)

    The string to display on the ProgressBar

Since:

API Level 1.0.0

setProgress(progressValue as Lang.Float or Null) as Void

Set the value of the ProgressBar.

Parameters:

  • progressValue(Lang.Float)

    The current value of the ProgressBar:

    • An increment from 0 to 100

    • null for "busy"

Since:

API Level 1.0.0


Generated Dec 11, 2024, 8:58:44 AM