Is it possible to handle an event for exiting a Toybox.WatchUi.Menu?
Thanks.
Is it possible to handle an event for exiting a Toybox.WatchUi.Menu?
Thanks.
No, but you can instead handle the onShow event for whatever view is displayed once the menu is exited.
Say you initially pushed the Menu view on top of a parent view (perhaps your app’s main view) — in the…
Have you looked at using Menu2 instead of Menu? I's not available on some old devices.
There you have access to onBack as well as more options for a menu items
In the SDK samples folder, there is Menu2Sample…
No, but you can instead handle the onShow event for whatever view is displayed once the menu is exited.
Say you initially pushed the Menu view on top of a parent view (perhaps your app’s main view) — in the parent view:
- before you push the Menu, set a boolean member variable to true, to indicate the menu will be displayed (e.g. isMenuDisplayed). To accomplish this, you may need to pass a parent view reference to the parent view’s input/behavior delegate (assuming the menu is opened via onMenu() / KEY_MENU)
- in onShow(), check the value of isMenuDisplayed. If it’s true, this means the user has just exited the menu. Set isMenuDisplayed to false, and take any appropriate action related to exiting the menu
Thank you. I will give that a go.
Thanks Jim ... I am still supporting API 1.4.0 watches
For me, this would be a case where I'd step back and consider dropping support for the devices that don't have Menu2. Over time, I've dropped some of the really old devices based on the app. There's no easy way to see how many active users still have these devices (in most cases 9-10 year old devices), you can kind of get a feel, based on the last review/contact developer message you've seen for them.
If you still want to support them, I'd look at using "has" or jungles to use Menu2 on devices that support Menu2