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

getDividerIcon() as Graphics.BitmapType or WatchUi.Drawable or Null

Get the divider icon.

Supported Devices:

Returns:

See Also:

Since:

API Level 5.0.1

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

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

setDividerIcon(icon as Graphics.BitmapType or WatchUi.Drawable or Lang.ResourceId or Null) as Void

Set or change the menu icon.

If device support Menu2.DividerType and parent menu is set to DIVIDER_TYPE_ICON, icon (if not +null+) will be rendered on the left side of the divider.

Parameters:

Supported Devices:

Since:

API Level 5.0.1

Throws:

setDrawable(drawable as WatchUi.Drawable or Null) 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 Dec 11, 2024, 8:58:44 AM