Checkbox settings and colour configuration

Hello,

I'm currently working on an app using menus and checkboxes.  The checkbox label and contents are to be stored in the settings, so the user enters what they need in the settings menu.  I am experiencing a few issues, the solutions which I could not find in the Programmer's Guide or in the forums and hoping to get some advice here.

1.  I set a default value for each menu title as a string, but I can't seem to get it to show up in the settings menu; it shows up blank on the device and the settings menu until the user types their custom title in.  Ideally it should display "List 1" as default until the user does their own thing, based on this code below.  What am I missing?

<property id="ListName01" type="string">List 1</property>

<setting propertyKey="@Properties.ListName01" title="@Strings.ListName01Title">
<settingConfig type="alphaNumeric"/>
</setting>

2.  After the user adds their settings, the display does not automatically update unless they go back to the home screen then to the menu list again.  I've added the onSettingsChanged function in the app.mc file with a message log enclosed.  I see the message in the log whenever the settings are changed, but the menu list or checkbox won't change dynamically while looking at them.

function onSettingsChanged() {
WatchUi.requestUpdate();
System.println("Settings changed!");
}

3.  Is it possible to change the colours of the menu list and checkbox from black on white?

Thanks in advance.

  • Are things working fine in the sim with the app settings editor in eclipse?

  • No, it's not working in the simulator, so I haven't tried it on a real device yet.  The app settings editor does not show the default (not sure if that only works for a certain type, such as numeric).

    Editied this to apologise for stating it shows blank on the device; I meant the simulator.

  • Are you sure that your properties are being built in the app?  In your project's bin directory, you should see a json file for your settings.

  • BTW, the object store sample in the SDK does both the object store as well as settings.  With it, you can make sure you're set up the proper way.

  • It's correct in the JSON file as far as I can see (I think):-

    "settings":[
    {
    "key":"ListName01",
    "valueType":"string",
    "defaultValue":"List 1",
    "configTitle":"ListName01Title",
    "configPrompt":null,
    "configHelpUrl":null,
    "configError":null,
    "configType":"alphaNumeric",
    "configReadonly":false,
    "configRequired":false,
    "configOptions":null,
    "configMin":null,
    "configMax":null,

  • Thanks, I looked at that sample before I came here.  The settings properties are exactly how I set it, but this time it's blank.  I will have another look to see if I'm missing anything.  I did use the default value on a previous project and it worked, but it was in a numerical format so I don't know if it makes a difference.

  • Try running the app in the simulator, then selecting "Reset All App Data", and see if your defaults are applied.

  • 2.  After the user adds their settings, the display does not automatically update unless they go back to the home screen then to the menu list again.  I've added the onSettingsChanged function in the app.mc file with a message log enclosed.  I see the message in the log whenever the settings are changed, but the menu list or checkbox won't change dynamically while looking at them.

    function onSettingsChanged() {
    WatchUi.requestUpdate();
    System.println("Settings changed!");
    }

    That's because requestUpdate() only asks the current view to redisplay itself, it doesn't ask the current view to *reconfigure* itself (or in some cases, to destroy and re-create itself, which would obviously not be great from a visual standpoint).

    If you are using CIQ 3, then Menu2 supports menu items with dynamic text (for example), so you can update all your items when settings have changed.

    developer.garmin.com/.../Menu2.html

    If you have to support CIQ < 3, you could try Dynamic Menu:

    github.com/.../Dmenu

  • I started this project based on the Input sample, so I did some "cleaning up" of codes and it's working again.  The Reset All App Data also worked.  Thanks.

  • Thanks for the help!  I believe the updateItem function is what I need; however I've been struggling to apply it in a way that will work.  After many attempts resulting in the sim crashing, I was able to use the below without it crashing any further but it has not made any difference to the update.  I could not find a practical example for this anywhere.

    Under Input Delegate:-

    function onMenu() {
    // 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(listName01, null, "check1", null));
    var list1 = menu.getItem(1);
    menu.updateItem(list1, 1);
    WatchUi.pushView(menu, new InputMenuDelegate(), WatchUi.SLIDE_UP);
    return true;
    }

    Regarding support, I wish to support as many devices as possible, but as the checkbox is significant in what I want to accomplish, I've decided to only support the CIQ 3 and above.  Fortunately that meant taking away support for only 3 devices which I regularly use - Approach S60/S62, 735xt and vivoactive HR which are below CIQ 3.

    Regarding the visual appearance of the checkboxes, would it be possible to do so? Fingers crossed