Hello all,
I have a toggle menu item built with code instead of xml
var toggleMenu = new WatchUi.Menu2({:title=>"Toggles"});
toggleMenu.addItem(new WatchUi.ToggleMenuItem("item1", {:enabled=>"Right Toggle: on", :disabled=>"Right Toggle: off"}, "item1", false, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT}));
When I try to find the current state of the toggle menu sub label with item.getSubLabel() I see the key/value pair below the code snippet ( item.getSubLabel().equals("enabled") does not work either)
if (item.getId().equals("item1")){
System.println(item.getSubLabel());
if (item.getSubLabel() == :enabled){
System.println("item1 toggle is enabled");
}
}
{symbol (8390438)=>Right Toggle: on, symbol (8390439)=>Right Toggle: off}
How do I get the current state of the toggle ( enabled or disabled) ?
I also tried item.isEnabled() and it just gives me an error below:
Cannot find symbol ':isEnabled' on type '$.Toybox.WatchUi.MenuItem'
Any thoughts or guidance is appreciated.