Class: Toybox.WatchUi.WatchFaceDelegate

Overview

Receive events on a Watch Face.

See Also:

Since:

API Level 2.3.0

App Types:

  • Audio Content Provider

  • Data Field

  • Glance

  • Watch App

  • Watch Face

  • Widget

Instance Method Summary collapse

Instance Method Details

getComplicationDrawable(complication as WatchFaceConfig.ComplicationRef) as WatchUi.Drawable or WatchUi.ComplicationDrawableRef or Null

Get a Drawable for highlighting purposes.

Called by system to get a Drawable for the given complication field for highlighting purposes. Only available in WatchFace config mode. Animation will be easing around the center of the Drawable. The Dc object passed to the Drawable.draw function shares the same origin as screen, e.g. at [0, 0], so it's aligned with the drawable coordinates for convenience.

Parameters:

  • complication(Complication)

    The complication field to get the highlight drawable for.

Supported Devices:

Returns:

  • WatchUi.Drawable, WatchUi.ComplicationDrawableRef

    The drawable that can be animated for highlighting purposes or null. In case of Drawable type, the bounding box is marked by the locX and locY as the top left corner, and the width and height as the size. In case of ComplicationDrawableRef, bounding box or other boundary type must be specified explictly.

See Also:

Since:

API Level 5.1.0

onPowerBudgetExceeded(powerInfo as WatchUi.WatchFacePowerInfo) as Void

Handle a partial update exceeding the power budget.

If the onPartialUpdate() callback of the associated WatchFace exceeds the power budget of the device, this method will be called with information about the limits that were exceeded.

Parameters:

See Also:

Since:

API Level 2.3.0

onPress(clickEvent as WatchUi.ClickEvent) as Lang.Boolean

Called when user does a touch and hold

Parameters:

Supported Devices:

Returns:

  • true if the click event is handled, otherwise false.

Since:

API Level 4.2.0

onTap(clickEvent as WatchUi.ClickEvent) as Lang.Boolean

A screen tap event has occurred.

Only available in WatchFace config mode. Can be overridden by application to change the selected complication, using WatchFaceDelegate.setSelectedComplication()

Parameters:

Supported Devices:

Returns:

  • Lang.Boolean

    true if the event was handled, false otherwise.

See Also:

Since:

API Level 5.1.0

onWatchFaceConfigEdited(options as { :configId as WatchFaceConfig.Id, :type as WatchUi.WatchFaceConfigType or Null, :committed as Lang.Boolean }) as Void

A watchface config change has occurred.

Only available in WatchFace config mode, application can call WatchFaceConfig.getSettings() to retrieve the current settings.

Parameters:

  • options(Lang.Dictionary)

    A Dictionary of options.

    • :configId(WatchFaceConfig.Id)

      The config id that has changed. This can be passed to WatchFaceConfig.getSettings() to retrieve the current settings.

    • :type(Type)

      The type of config that has changed. if missing or null, indicates the end of previous editting.

    • :committed(Lang.Boolean)

      true if user has committed the change, false otherwise.

Supported Devices:

See Also:

Since:

API Level 5.1.0

setSelectedComplication(complicationIdentifier as Lang.Number) as Void

Set the selected complication field.

Can be called by application when handling onTap event, to change the selected (highlighted) complication. Only effective during WatchFace config mode.

Parameters:

  • complicationIdentifier(Lang.Number)

    The unique identifier of complication to set as selected.

Supported Devices:

See Also:

Since:

API Level 5.1.0

Throws:


Generated Mar 4, 2025, 4:09:54 PM