Class: Toybox::WatchUi::NumberPicker Deprecated

Inherits:
Lang::Object show all

Overview

Deprecated.

This class will be removed in Connect IQ 3.0.0

Note:

The look and feel of a number picker is device-specific.

A representation of an on-screen number picker.

A NumberPicker is a special View that provides a way to specify numeric values within an app. A NumberPicker is pushed using pushView() and provides a NumberPickerDelegate as the input delegate.

The NumberPicker class is limited to the eight specific modes described by the WatchUi.NUMBER_PICKER_* types enum. There are set minimum and maximum values enforced by the product for each mode, and the initial value of the NumberPicker will be adjusted to fall within these bounds.

Examples:

Display a distance picker when the Menu button is pressed

using Toybox.WatchUi;

class MyNumberPickerDelegate extends WatchUi.NumberPickerDelegate {
    function initialize() {
        NumberPickerDelegate.initialize();
    }

    function onNumberPicked(value) {
        myValue = value; // e.g. 1000f
    }
}

class MyInputDelegate extends WatchUi.BehaviorDelegate {
    var myPicker;

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

    function onMenu() {
        if (WatchUi has :NumberPicker) {
            myPicker = new WatchUi.NumberPicker(
                WatchUi.NUMBER_PICKER_DISTANCE,
                myValue
            );
            WatchUi.pushView(
                myPicker,
                new MyNumberPickerDelegate(),
                WatchUi.SLIDE_IMMEDIATE
            );
        }
        return true;
    }
}

See Also:

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(mode, initialValue) ⇒ NumberPicker

Returns a new instance of NumberPicker

Parameters:

Since:

  • 1.0.0


15092
15093
# File 'Monkeybrains.rb', line 15092

def initialize(mode, initialValue)
end