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


14763
14764
# File 'Monkeybrains.rb', line 14763

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


14782
14783
# File 'Monkeybrains.rb', line 14782

def getSubLabel()
end

isEnabledToybox::Lang::Boolean

Get a ToggleMenuItem state.

Returns:

Since:

  • 3.0.0


14795
14796
# File 'Monkeybrains.rb', line 14795

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


14789
14790
# File 'Monkeybrains.rb', line 14789

def setEnabled(enabled)
end

setSubLabel(subLabel) ⇒ Object

Set a ToggleMenuItem label substring.

Parameters:

Options Hash (subLabel):

Since:

  • 3.0.0


14775
14776
# File 'Monkeybrains.rb', line 14775

def setSubLabel(subLabel)
end