Class: Toybox::WatchUi::ToggleMenuItem

Inherits:
MenuItem show all

Overview

A representation of a toggle item in a Menu2.

A ToggleMenuItem is a element of a Menu2 View that represents one of the options in the menu, and includes an indicator on the menu item that appears in one of two states: enabled or disabled. When selected, the state of the ToggleMenuItem changes to the state opposite of the state prior to the onSelect delegate callback invocation.

A ToggleMenuItem can be added to a Menu2 using the addItem() method.

See Also:

Since:

  • 3.0.0

Constant Summary

Constants inherited from MenuItem

MenuItem::MENU_ITEM_LABEL_ALIGN_LEFT, MenuItem::MENU_ITEM_LABEL_ALIGN_RIGHT

Instance Method Summary collapse

Methods inherited from MenuItem

getId, getLabel, setLabel

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(label, subLabel, identifier, enabled, options) ⇒ ToggleMenuItem

Returns a new instance of ToggleMenuItem

Parameters:

Options Hash (subLabel):

Options Hash (options):

Since:

  • 3.0.0


13389
13390
# File 'Monkeybrains.rb', line 13389

def initialize(label, subLabel, identifier, enabled, options)
end

Instance Method Details

getSubLabelToybox::Lang::String, Toybox::Lang::Dictionary

Get a ToggleMenuItem label substring.

Returns:

Since:

  • 3.0.0


13408
13409
# File 'Monkeybrains.rb', line 13408

def getSubLabel()
end

isEnabledToybox::Lang::Boolean

Get a ToggleMenuItem state.

Returns:

Since:

  • 3.0.0


13421
13422
# File 'Monkeybrains.rb', line 13421

def isEnabled()
end

setEnabled(enabled) ⇒ Object

Set a ToggleMenuItem state.

Parameters:

  • enabled (Toybox::Lang::Boolean)

    The intended state of the ToggleMenuItem; enabled if true, disabled if false

Since:

  • 3.0.0


13415
13416
# File 'Monkeybrains.rb', line 13415

def setEnabled(enabled)
end

setSubLabel(subLabel) ⇒ Object

Set a ToggleMenuItem label substring.

Parameters:

Options Hash (subLabel):

Since:

  • 3.0.0


13401
13402
# File 'Monkeybrains.rb', line 13401

def setSubLabel(subLabel)
end