Class: Toybox::WatchUi::CheckboxMenu

Inherits:
Menu2 show all

Overview

Note:

The look and feel of a CheckboxMenu is device-specific.

A representation of a check box menu.

A CheckboxMenu is a specialized Menu2 View that presents the user with a list of check box options. After an option is selected, the registered onSelect() method will be called. While a CheckboxMenu can be generated programmatically, they should generally be created as a resource.

A CheckboxMenu is pushed using pushView(), which provides a Menu2InputDelegate as the input delegate.

Examples:

Build a simple CheckboxMenu programmatically

using Toybox.WatchUi;

class MyBehaviorDelegate extends WatchUi.BehaviorDelegate {
    function initialize() {
        BehaviorDelegate.initialize();
    }

    function onMenu() {
        var menu = new WatchUi.CheckboxMenu({:title=>"My CheckboxMenu"});
        var delegate;
        menu.addItem(
            new CheckboxMenuItem(
                "Item 1 Label",
                "Item 1 subLabel",
                "itemOneId",
                true,
                {}
            )
        );
        menu.addItem(
            new CheckboxMenuItem(
                "Item 2 Label",
                "Item 2 subLabel",
                "itemTwoId",
                false,
                {}
            )
        );
        delegate = new MyMenu2Delegate(); // a WatchUi.Menu2InputDelegate
        WatchUi.pushView(menu, delegate, WatchUi.SLIDE_IMMEDIATE);
        return true;
    }
}

See Also:

Since:

  • 3.0.0

Instance Method Summary collapse

Methods inherited from Menu2

deleteItem, findItemById, getItem, setFocus, setTitle, updateItem

Methods inherited from View

addLayer, clearLayers, findDrawableById, getLayerIndex, getLayers, insertLayer, onHide, onLayout, onShow, onUpdate, removeLayer, setKeyToSelectableInteraction, setLayout

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(options) ⇒ CheckboxMenu

Returns a new instance of CheckboxMenu

Parameters:

Options Hash (options):

Since:

  • 3.0.0


14384
14385
# File 'Monkeybrains.rb', line 14384

def initialize(options)
end

Instance Method Details

addItem(item) ⇒ Object

Add a CheckboxMenuItem to a CheckboxMenu.

Parameters:

Since:

  • 3.0.0


14391
14392
# File 'Monkeybrains.rb', line 14391

def addItem(item)
end