Class: Toybox.WatchUi.KeyEvent

Inherits:
Toybox.Lang.Object show all

Overview

KeyEvent is an object sent to an InputDelegate when a physical button on the device is pressed.

See Also:

Example:

using Toybox.System;
using Toybox.WatchUi;

class InputDelegate extends WatchUi.BehaviorDelegate {
    function onKey(keyEvent) {
        System.println(keyEvent.getKey());  // e.g. KEY_MENU = 7
        System.println(keyEvent.getType()); // e.g. PRESS_TYPE_DOWN = 0
        return true;
    }
}

Since:

API Level 1.0.0

Instance Method Summary collapse

Instance Method Details

getKey() as WatchUi.Key

Get the key value of this event.

Returns:

Since:

API Level 1.0.0

getType() as WatchUi.KeyPressType

Get the type of click event.

Returns:

Since:

API Level 1.1.2


Generated Mar 18, 2024 2:40:14 PM