onMenu behavior with Menu2/CustomMenu

Good morning,

Is there a way to implement onMenu behavior within a CustomMenu?

The Menu2InputDelegate doesn't appear to provide an onMenu method. I tried implementing it manually, but it doesn't seem to be triggered.

Is there a known workaround or recommended approach for this scenario?

Top Replies

All Replies

  • It seems onWrap() behaves a bit differently than other delegate functions. According to the documentation:

    Oh sorry haha should've read the manual

  • With CustomMenu, the behavior is closer to what I need. There’s no onWrap() method

    Sorry if I'm missing something, but CustomMenu inherits from Menu2 and both Menu2 and CustomMenu use a Menu2InputDelegate, which implements onWrap(). Furthermore, the Menu2Sample SDK sample's "Wrap Out" menu (MenuSampleWrapCustom.mc) is an explicit example of a custom menu which implements onWrap().

    Yes, it's true that as per the doc, prior to CIQ 5.1.0, some of the methods on Menu2InputDelegate were only called for CustomMenu (but as of CIQ 5.1.0, these methods "are used for all Menu2 types"). However, I don't see anything in the docs which says that certain methods are only for Menu2 (base class) and not CustomMenu.

    Btw, I don't see your bad wrapping behaviour on a real fr955, when I test the Menu2Sample SDK sample.

  • I should have been more precise:

    With CustomMenu, if onWrap() is not implemented (i.e., wrapping is allowed), but onNextPage() and onPreviousPage() are implemented and return true, wrapping no longer occurs. If neither onNextPage() nor onPreviousPage() is implemented, then wrapping does happen as expected.

    With Menu2, however, returning false from onWrap(), or returning true from onNextPage() and onPreviousPage(), doesn't seem to prevent wrapping at all. This happens only on the real device, in the simulator wrapping can be disabled as expected.

    Have you tested whether it's actually possible to disable wrapping with Menu2 (not CustomMenu) on the Forerunner 955?

    One idea I haven’t tried yet is whether changing the focus inside onWrap() or within the paging methods (onNextPage()/onPreviousPage()) could help prevent the wrap.

    Maybe I’m also missing something - right now my wife and kid need my attention, so I only have limited time to experiment with this. ;-)

  • Have you tested whether it's actually possible to disable wrapping with Menu2 (not CustomMenu) on the Forerunner 955?

    No, I just tested menu2sample, which uses onWrap() in CustomMenu.

    I was more focused on the statement about "no onWrap() method", which I now understand to mean that there's no need to override onWrap() in your implementation.

    That makes sense, as I think onNextPage() / onPreviousPage() are sort of functionally equivalent to onWrap(), except that the former functions are triggered by both swipes and button presses, while the latter is only triggered by button presses. (Ofc, Garmin watches don't wrap menus on swipes, just button presses, which explains the separate sets of functions and the different names.)

  • Have you tested whether it's actually possible to disable wrapping with Menu2 (not CustomMenu) on the Forerunner 955?

    I tested this just now [by modifying menu2sample], and I see the same thing as you: returning false in onWrap() has no effect for a Menu2 (not CustomMenu).

    It's kinda funny that with CIQ 5.1.0, as per the docs, Garmin changed the Menu2InputDelegate so a bunch of methods that were previously only for CustomMenu also apply to Menu2 in general, but it seems that they also added a bunch of new methods which are [apparently] inadvertently only for CustomMenu....

  • I tested this just now [by modifying menu2sample], and I see the same thing as you: returning false in onWrap() has no effect in a Menu2.

    Thanks for confirming and reproducing it. Slight smile

    One small upside: when using CustomMenuItem instead of the standard MenuItem, the sub-label can be a TextArea that automatically adjusts its font size based on the content.