Menu2 resource format

Former Member
Former Member
Guys,
I'm sorry to have again question regarding new CIQ 3.0 features... but can't find answer in both - API and programmer's guide.
Also the only sample is building menu not through resource... so -
what is the resource format for new Menu2?

I believe it starts with something like
<menu2 id=… title=…>

from errors I see that there should be a new key <label> but guessing all of that from errors is not so easy.

Top Replies

All Replies

  • It looks like the implementation is in place, but it isn't documented. I'll see about posting some samples here when I get a chance.
  • I think this should cover most scenarios. I've not played with this particular bit of functionality, but this should work with the 3.0.0beta3 SDK.

    <menu2 id="myMenu" title="@MyBarrel.Strings.menu_label">
    <menu-item id="menu_item_1" label="@Strings.menuItem1Label">
    <param name="alignment">Toybox.WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT</param>
    </menu-item>
    <menu-item id="menu_item_2" label="@Strings.menuItem2Label" subLabel="@Strings.subLabelString" />

    <toggle-menu-item id="toggle_menu_item1" label="@Strings.toggleMenuItem1Label" checked="true" />
    <toggle-menu-item id="toggle_menu_item2" label="@Strings.toggleMenuItem2Label"
    subLabel="@Strings.toggleMenuItem2SubLabel"
    checked="false">
    <param name="alignment">Toybox.WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT</param>
    </toggle-menu-item>
    <toggle-menu-item id="toggle_menu_item4" label="@Strings.toggleMenuItem4Label"
    subLabel="@Strings.toggleMenuItem4SubLabel"
    disabledSubLabel="@Strings.toggleMenuItem4DisabledSubLabel"
    checked="true" />

    <icon-menu-item id="icon_menu_item1" label="@Strings.iconMenuItem1Label"
    subLabel="@MyBarrel.Strings.iconMenuItem1SubLabel" icon="@Drawables.iconMenuItem1Icon1">
    <param name="alignment">Ui.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT</param>
    </icon-menu-item>
    <icon-menu-item id="icon_menu_item2" label="@MyBarrel.Strings.iconMenuItem2Label"
    icon="@MyBarrel.Drawables.iconMenuItem2Icon2" />

    <checkbox-menu-item id="checkbox_menu_item" label="@Strings.checkboxMenuItemLabel" />
    </menu2>
  • Former Member
    Former Member over 6 years ago
    Thank you Travis! :)
    I was afraid, I missed something in documentation
  • Could you provide example how to use / initialise / show menu2 with resource(s) listed above?

  • You do it just like you do for a regular menu. The Programmer's Guide has an example, but here is a brief snippet that shows how you'd do it for the above menu definition:

    Ui.pushView( new Rez.Menus.myMenu(), new MyMenuDelegate(), Ui.SLIDE_UP );
    //           ^^^^^^^^^^^^^^^^^^^^

  • thank you, going to try it

  • This is documented now, but the location is slightly unintuitive (imo anyway).

    For anyone trying to find it in the online docs, go to Core Topics > Native Controls > Scroll down to Menu2 (or use this link).