Class: Toybox.WatchUi.TextPickerDelegate

Overview

TextPickerDelegate responds to a TextPicker selection.

This class should be extended to handle the specified text.

See Also:

Example:

using Toybox.WatchUi;

// A string to display on the screen
var screenMessage = "Press Menu to Enter Text";
var lastText = "";

class MyTextPickerDelegate extends WatchUi.TextPickerDelegate {

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

    function onTextEntered(text, changed) {
        screenMessage = text + "\n" + "Changed: " + changed;
        lastText = text;
    }

    function onCancel() {
        screenMessage = "Canceled";
    }
}

Since:

API Level 1.1.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

onCancel() as Lang.Boolean

Text entry has been canceled.

Since:

API Level 1.1.0

onTextEntered(text as Lang.String, changed as Lang.Boolean) as Lang.Boolean

A text string was entered into a TextPicker.

This method is called when text has been specified by a TextPicker, and receives the text String as an argument.

Parameters:

  • text(Lang.String)

    The entered text

  • changed(Lang.Boolean)

    The entered text differs from the initially specified text of the TextPicker

Since:

API Level 1.1.0


Generated Sep 23, 2024, 3:32:49 PM