Class: Toybox::WatchUi::KeyEvent

Inherits:
Lang::Object show all

Overview

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

Examples:

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;
    }
}

See Also:

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Method Details

getKeyToybox::Lang::Number

Get the key value of this event.

Returns:

Since:

  • 1.0.0


12821
12822
# File 'Monkeybrains.rb', line 12821

def getKey()
end

getTypeToybox::Lang::Number

Get the type of click event.

Returns:

Since:

  • 1.1.2


12828
12829
# File 'Monkeybrains.rb', line 12828

def getType()
end