Hello,
I'm trying to setup basic on-device settings on my 955 watch face, reusing Jim's Menu2 code snippets, as found on the forum :
class watch00App extends Application.AppBase { var _temp as Boolean?; function initialize() { AppBase.initialize(); _temp = false; } // onStart() is called on application start up function onStart(state as Dictionary?) as Void { } // onStop() is called when your application is exiting function onStop(state as Dictionary?) as Void { } // Return the initial view of your application here function getInitialView() as Array<Views or InputDelegates>? { return [ new watch00View() ] as Array<Views or InputDelegates>; } function getSettingsView() { return [new SLeanSettingsMenu(),new SLeanSettingsMenuDelegate()]; } } class SLeanSettingsMenu extends WatchUi.Menu2 { function initialize() { Menu2.initialize(null); Menu2.setTitle("Settings"); Menu2.addItem(new WatchUi.ToggleMenuItem("Show Seconds When Possible", null,"sec",getApp()._temp, null)); //other things } } class SLeanSettingsMenuDelegate extends WatchUi.Menu2InputDelegate { function initialize() { Menu2InputDelegate.initialize(); } function onSelect(item) { System.println("onSelect() entered!"); System.println(item.getId()); var id=item.getId(); if(id.equals("sec")) { getApp()._temp = !getApp()._temp; System.println(getApp()._temp); // MySettings.showSecs=!MySettings.showSecs; // MySettings.writeKey(MySettings.showSecsKey,MySettings.showSecs); } } function onBack() { WatchUi.popView(WatchUi.SLIDE_IMMEDIATE); return; } } function getApp() as watch00App { return Application.getApp() as watch00App; }
It works fine on the sim, when triggering the watch face settings, then escaping it...
But on my 955, even if the settings menu appears in the watch face menu, and even if I can select the option, switch the boolean ON/OFF, then come back, the onSelect() function is never entered !?! There's no trace of the println in the log files (all other logs are there though), and the boolean value is never stored/modified.
What could prevent the onSelect() function to be called ? And why is it working on the sim and not on the watch ?
Thanks for your help!
Nicolas.