Is there any good documentation for how to implement on-watch screen menus? Or an example? The info on how to do this seems very sparse and incomplete.
Is there any good documentation for how to implement on-watch screen menus? Or an example? The info on how to do this seems very sparse and incomplete.
Where do you want a menu? Just in general, in the SDK there are the MenuTest and Menu2Sample samples. There might be something with an ActionMenu in some sample, but I've not seen it.
The analog watch face same shows using a menu for on device settings, if that's what you are looking for (using Menu2) but it's a bit clumsy with an extra view last I looked. Search this forum for "on-device settings" for more info on what can be done.
I tried the Menu2Sample sample. When it is launched, the screen says to push a menu button. I tried pushing the menu button on a watch that has it (Fenix 7, 7X) and nothing happens. On other watches, the Trigger App Settings in the simulator menu is always greyed out and cannot be selected. I know some versions of the SDK had all buttons but the back button inoperable, so maybe that is partly the cause. But I tried 3 different SDK versions (6.3.1, 6.4.1, 6.2.0) and the same result. Any hints?
The Menu2Sample works for me. Are you pushing and holding the menu button with the app running? i.e. a long hold. Much like you would to bring up the menu from the watch face. I've not heard of any SDK versions where the buttons are inoperable.
I see , I wasn't aware it requires push and hold. OK that works. But what about the Trigger App Settings menu selection in the simulator being greyed out for devices with no left hand side buttons?
short press is up arrow, long press is menu. As Jim says, on the touch screen watches with 2 buttons, menu is long press of lower right.
However for a watchface to activate the menu, that doesn't work and I have to use the "Trigger App Setings" in the simulator menu. What about on a real device, Fenix series with a Menu button, and Vivoactive, lower right button? Should a long press on thos buttons for a watchface show the watchface settings menu?
Watch face settings are different to a menu you have explicitly associated with the menu button.
If you are coding watch face settings you'll need to use the option from the simulator.
If you are coding a menu and pushing this from a delegate, you'll need to use whichever button or action you have specified in your delegate. That could potentially be any button or action as its dependent on your code.
If you push a menu from the menu function in a delegate, that will only appear on a real watch or in the sim if you long press the button assigned to the menu action. 5 button watches, that's the middle left. 2 button watches, that's the lower right.
Using the trigger app settings will do nothing for that kind of menu on any watch. This option is to bring up a menu you have coded explicitly for settings.
Thanks for the quick response. That is really hard to follow unfortunately.
It sounds like on Fenix, one can use a long press on the Menu button to bring up a watchface settings menu. Just exactly how I can't seem to follow yet.
What I don't get is that on Vivoactive, when a watchface is active, there are already functions assigned to long press of both buttons. Are you saying it is possible to override the long press of the lower right button to bring up a watchface settings menu?
You need to separate "watch face settings" from any general menu you coded such as those in the Menu2Sample.
If you are using app settings, you will have a function in you main app AppBase class called getSettingsView which returns a view for your watch face settings. See the Analog sample for an example if this. It's in AnalogApp.mc This is only applicable to watch faces or data fields.
This function is called from within the simulator by selecting the option Trigger App Settings.
On a watch, this function is called when you select the watch face from the main watch settings menu, select your watch face and then select settings bfore you apply the watch face.
This menu will not be available elsewhere when running in the simulator or when the watch face is running on the watch.
If you have some other kind of app, other than a watch face, e.g. a watch app or a widget, such as Menu2Sample, any menu you create will not be available from the option Trigger App Settings in the simulator.
This menu will be triggered by using the button you have explicitly defined to bring up the menu view. So, for example in the Menu2Sample you have in MenuTestDelegate.mc:
class Menu2TestDelegate extends WatchUi.BehaviorDelegate { //! Constructor public function initialize() { BehaviorDelegate.initialize(); } //! Handle the menu event //! @return true if handled, false otherwise public function onMenu() as Boolean { // Generate a new Menu with a drawable Title var menu = new WatchUi.Menu2({:title=>new $.DrawableMenuTitle()}); // Add menu items for demonstrating toggles, checkbox and icon menu items menu.addItem(new WatchUi.MenuItem("Toggles", "sublabel", "toggle", null)); menu.addItem(new WatchUi.MenuItem("Checkboxes", null, "check", null)); menu.addItem(new WatchUi.MenuItem("Icons", null, "icon", null)); menu.addItem(new WatchUi.MenuItem("Custom", null, "custom", null)); WatchUi.pushView(menu, new $.Menu2TestMenu2Delegate(), WatchUi.SLIDE_UP); return true; } }
So, the menu is displayed when you hit the menu button. i.e. long press of the middle left button on a fenix, or the lower right button on a vivoactive.
If you changed the code and re-named onMenu() to onSelect(), the menu would not appear when pressing the menu button. It would appear when you trigger the select function. This is the top right button on a fenix, but is not assigned to any button on a vivoactive, you'd need to tap the screen instead.
This behaviour is NOT applicable to watch faces.
You appear to be confusing a watch face settings menu which is returned by getSettingsView() with a widget menu which you have pushed in the delegate associated with a particular button or other behaviour such as tapping or swiping the screen.
A watch face cannot have a delegate which handles events or behaviours associated with buttons so you cannot associate a menu with a button.
A watch app or widget cannot have "App Settings" triggered by the "Trigger App Settings" option.