Class: Toybox.WatchUi.CustomMenuItem

Overview

A representation of a custom item in a CustomMenu.

A CustomMenuItem is a element of a CustomMenu View that represents one of the items in the menu. When selected, the onSelect() delegate callback will be invoked. The selected state of the item may change when it is being selected. This state can be evaluated using the isSelected() method and can be used to control the look of a selected item.

A CustomMenuItem can be added to a CustomMenu using the addItem() method.

See Also:

Since:

API Level 3.0.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

draw(dc as Graphics.Dc) as Void

Draw method for a CustomMenuItem.

This is called when a menu item is rendering.

Parameters:

Since:

API Level 3.0.0

initialize(identifier, options as { :alignment as MenuItem.Alignment, :drawable as WatchUi.Drawable, :icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol })

Constructor

Note:

The :icon option is only used on ConnectIQ 3.4.0 devices with subscreen support.

Parameters:

See Also:

Since:

API Level 3.0.0

Throws:

isFocused() as Lang.Boolean

Get the CustomMenuItem focus state.

Returns:

  • Lang.Boolean

    The current focus state of the CustomMenuItem

Since:

API Level 3.0.0

isSelected() as Lang.Boolean

Get the CustomMenuItem selected state.

Returns:

  • Lang.Boolean

    The current selected state of the CustomMenuItem

Since:

API Level 3.0.0

setDrawable(drawable as WatchUi.Drawable) as Void

Set a CustomMenuItem Drawable.

Parameters:

  • drawable(WatchUi.Drawable)

    A Drawable to render on top of the menu items, or null.

Since:

API Level 3.0.0

Throws:


Generated May 31, 2023 8:48:51 AM