Class: Toybox.WatchUi.Picker

Overview

A representation of an on-screen generic picker.

A Picker consists of one or more choose-able objects, a title, a next and previous arrow, and a confirmation button. The next and previous arrows and the confirmation button are device specific but can be overridden if desired. A Picker is pushed using pushView(), which provides a PickerDelegate.

A PickerFactory is required to indicate what should be displayed for each pick-able value, and is capable of displaying any number of entries from which may be chosen. For example, consider the following:

     new NumberFactory();
     new Ui.Text({:text=>"-"});
     new NumberFactory();

This Picker will have three entries: a choosable number, a non-choosable "-", and another choosable number.

See Also:

Note:

See the Picker sample distributed with the SDK for an example of the use of the Picker class

Note:

The look and feel of a Picker is device-specific, though every device will have the same general layout.

Since:

API Level 1.2.0

Supported Devices:

Typedef Summary collapse

Instance Method Summary collapse

Typedef Details

Options as { :title as WatchUi.Drawable, :pattern as Lang.Array<WatchUi.Drawable or WatchUi.PickerFactory>, :defaults as Lang.Array<Lang.Number>, :nextArrow as WatchUi.Drawable, :previousArrow as WatchUi.Drawable, :confirm as WatchUi.Drawable }

Since:

API Level 1.2.0

Instance Method Details

initialize(options as Picker.Options)

Constructor

Parameters:

  • options(Lang.Dictionary)

    A Dictionary containing the options for the Picker object

See Also:

Since:

API Level 1.2.0

setOptions(options as Picker.Options) as Void

Set the options for the Picker.

Parameters:

  • options(Lang.Dictionary)

    A Dictionary containing the options for the Picker object

    • :title(WatchUi.Drawable)

      The title for the Picker (required)

    • :pattern(Lang.Array)

      An Array of either Drawable or PickerFactory objects for the Picker to display. A PickerFactory presents a choice of Pickers, while a Drawable immediately displays the Picker (required)

    • :defaults(Lang.Array)

      An Array of Number objects indicating the starting index for each entry in the supplied pattern (optional)

    • :nextArrow(WatchUi.Drawable)

      A custom next icon for the Picker (optional)

    • :previousArrow(WatchUi.Drawable)

      A custom previous icon for the Picker (optional)

    • :confirm(WatchUi.Drawable)

      A custom confirmation icon for the Picker (optional)

See Also:

Since:

API Level 1.2.0


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