WatchUi.Menu - What's a consistent way to decide whether I should call popView on menu item click?

My app uses WatchUi.Menu. When the user clicks a menu item on "old" watches (~2 years ago), the menu is popped, and I didn't call popView in my MenuInputDelegate so far. I'm trying to port the app to new devices, and for some looks like it does not pop the menu on click, at least not in the Simulator - the menu stays and causes issues.

Even worse, I didn't find a consistent way to determine when I should explicitly call popView - checking if the device is a touch screen mostly works, but for some older touch screen watches not so much.

So, when (and if at all) should I explicitly call popView on my MenuItemDelegate?

Thank you!

  • I know the pain from apps where I use Menu2 for new devices and Menu for old devices. I think the answer is that the difference in behaviour is whether the device supports Menu2 or not. Though if you mean that only by adding new devices to the manifest, and still use Menu produces the problem, then there might be some other difference as well.

    I hope this means you're adding new devices to the toothbrush timer and the bouldering apps ;)

  • I probably wouldn't use Menu on devices which support Menu2, because of issues like you described.

    A known issue of Menu, on FR935 and Fenix 5, is that "English" is displayed as the title, instead of actual title text. This behaviour is only seen on real devices, not in the sim. (Then again, at this point, maybe those devices are so old that your app doesn't support them?)

  • Yes, I finally started porting all those apps :) Had them on Eclipse, so first had to transition to VS Code... Indeed I just added newer devices to the manifest and fixed some compile time issues - as far as I tested in the sim, it all seems to work for new and old devices - except this different menu behavior.

    So the preferred solution is to use Menu2 where supported, right? Or maybe, kind of ugly but I could test if Menu2 is there, and if so not use it but just add an extra popView.

  • I'd like to keep support for old devices, which don't have Menu2. Specifically for climbing app I wrote, Garmin added a built-in app in newer devices (maybe even took ideas from my app - cool :)) so it's mostly older devices that I'd like to support + a few new devices that don't have Garmin's built-in app.

    Thanks!

  • I'd like to keep support for old devices, which don't have Menu2

    Sure I get it. So I think the solution is, as you said:

    So the preferred solution is to use Menu2 where supported

    For example, the bug I mentioned with Menu and FR935/Fenix 5 is not a problem if you use Menu2, which is supported for both of those devices.

    I also think Garmin wants devs to use Menu2 (and not Menu) wherever possible. For example, the Resources core topic doc is written as if Menu2/<menu2> is the default menu component (which I guess it is, if you don't consider ancient devices which lack Menu2):

    https://developer.garmin.com/connect-iq/core-topics/resources/

    Standard Menus

    Menus are defined using the <menu2> element, which has the following attributes:

  • What's the preferred approach for "dynamically" using either Menu2 if supported and Menu otherwise?

    I'm using res for menus - perhaps I should maintain 2 sets of resources and load the preferred one? Or should I move my menu creation to code, and dynamically create the type of menu and menu items according to the capabilities (that would kind of clutter the code...)?

    Thanks again!

  • It doesn't matter if it's XML resources or source code. You'll have 2 directories like resources-menu, resources-menu2 or source-menu and source-menu2 and use them accordingly from monkey.jungle

  • It doesn't matter if it's XML resources or source code. You'll have 2 directories like resources-menu, resources-menu2 or source-menu and source-menu2 and use them accordingly from monkey.jungle

    Not necessarily. As eran_levi implied, if you create your menus in MC source code (as opposed to resources), then you have the simpler option of using a has check to determine whether Menu2 is available, rather than having multiple sets of menu source/resource files and hardcoding which set to use via monkey.jungle.

    If you are committed to using resources, then your approach is pretty much the only way to do it.

  • You don't even need that.  I build the menus in the code and based on a "has" check For Menu2, use that or Menu.

    Menu2 came out with CIQ 3.0.0 so the only devices without Menu2 are CIQ1  and CIQ2 and there are only a few of those and they came out maybe 8 years ago, and you'll probably not see many users with those at this time, so an option is to just drop those and always use Menu2.

    Menu2 has some nice options.  There's a Menu2 sample in the SDK