Glances: any example in SDK? Strange error in simulator.

Finally decided to move to glances support.

That's odd no example in SDK.

Ok, found some on this forum. Added and got error during runtime.

I have no idea what is wrong in this code:

using Toybox.WatchUi as Ui;

....

(:glance)
class Project_MyGlanceView extends Ui.GlanceView {

...

    // Load your resources here
    function onLayout(dc) {
        lbl_SensorLabel = Ui.loadResource( Rez.Strings.SensorLabel );  // that line causes Error.

Error: Illegal Access (Out of Bounds)
Details: Failed invoking <symbol>
Stack:
  - onLayout() at C:\Garmin\Work2\Project_My\source\Project_MyGlanceView.mc:256 0x10000879

Does it mean loadResource forbidden in onLayout in glances? I do really need localized strings on layout.

Parents
  • If you look at this thread, I posted a really simple sample back when glances first came out:

    https://forums.garmin.com/developer/connect-iq/f/discussion/191347/widgets-for-fenix-6

    What is likely happening without seeing your code, is you need to scope resources so you can access them.  See the programmer's guide, but here's the basics:

    Resource Scopes (Connect IQ 3.1)

    <resources>
        <string id="MyBackgroundString" scope="background">Background String</string>
        <string id="MyGlanceString" scope="glance">Glance String</string>
        <string id="MyForegroundString" scope="foreground">Foreground String</string>
    </resources>
Reply
  • If you look at this thread, I posted a really simple sample back when glances first came out:

    https://forums.garmin.com/developer/connect-iq/f/discussion/191347/widgets-for-fenix-6

    What is likely happening without seeing your code, is you need to scope resources so you can access them.  See the programmer's guide, but here's the basics:

    Resource Scopes (Connect IQ 3.1)

    <resources>
        <string id="MyBackgroundString" scope="background">Background String</string>
        <string id="MyGlanceString" scope="glance">Glance String</string>
        <string id="MyForegroundString" scope="foreground">Foreground String</string>
    </resources>
Children