Class: Toybox.WatchUi.CheckboxMenuItem

Overview

A representation of a check box item in a CheckboxMenu.

A CheckboxMenuItem is a element of a CheckboxMenu View that represents one of the options in the menu, and can appear in one of two states: checked or unchecked. When selected, the state of the CheckboxMenuItem changes to the state opposite of the state prior to the onSelect delegate callback invocation.

A CheckboxMenuItem can be added to a CheckboxMenu using the addItem() method.

See Also:

Since:

API Level 3.0.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

initialize(label as Lang.String or Lang.Symbol, subLabel as Lang.String or Lang.Symbol or Null, identifier, checked as Lang.Boolean, options as { :alignment as MenuItem.Alignment, :icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol } or Null)

Constructor

Note:

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

Parameters:

  • label(Lang.String, Lang.Symbol)

    The string label for the CheckboxMenuItem

  • subLabel(Lang.String, Lang.Symbol)

    The substring label for the CheckboxMenuItem, which can be null

  • identifier(Lang.Object)

    The identifier for this CheckboxMenuItem, which is typically a String

  • checked(Lang.Boolean)

    The initial state of the CheckboxMenuItem; checked if true, unchecked if false

  • options(Lang.Dictionary)

    A Dictionary of options

    • :alignment(Lang.Number)

      A WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_* constant representing the label alignment, which defaults to the system default for check box menu items if not specified.

    • :icon(Graphics.BitmapType, WatchUi.Drawable, Lang.Symbol)

      for the subscreen area when the menu item is in focus

Since:

API Level 3.0.0

isChecked() as Lang.Boolean

Get a CheckboxMenuItem state.

Returns:

  • Lang.Boolean

    The current state of the CheckboxMenuItem

Since:

API Level 3.0.0

setChecked(checked as Lang.Boolean) as Void

Set a CheckboxMenuItem state.

Parameters:

  • checked(Lang.Boolean)

    The intended state of the CheckboxMenuItem; checked if true, unchecked if false

Since:

API Level 3.0.0

Throws:


Generated Jan 5, 2024 1:53:16 PM