Unexpected Type Error

Former Member
Former Member
My datafield compiles but i get this when i run it in the simulator:
Connecting...
Connecting to device...
Device Version 0.32.-Device id 0 name "A garmin device"
Shell Version -10097Failed invoking <symbol>
Unexpected Type Error
@PC = 0x10000c74
@PC = 0x100000f7
Unexpected Type Error
Unexpected Type Error


The code is attached and its easy to build and run if you have connectiq sdk on your PATH:
$ sh build.sh
$ sh run.sh



ConnectIQ SDK 1.1.0 on mac osx
  • I downloaded you code and created a project in Eclipse. I have seen two problems:

    - ScalableTextDrawer.mc line 138: "text.length" should be "text.length()" - it is not a field but a method
    - In Dimension.mc you have

    function initialize(width, height) {
    width = width;
    height = height;
    }


    but it must be

    function initialize(w, h) {
    width = w;
    height = h;
    }


    There might be more, but this should get you over this problem...
  • FYI, you can also write...

    function initialize(width, height) {
    self.width = width;
    self.height = height;
    }
  • Former Member
    Former Member over 10 years ago
    I downloaded you code and created a project in Eclipse. I have seen two problems:

    - ScalableTextDrawer.mc line 138: "text.length" should be "text.length()" - it is not a field but a method
    - In Dimension.mc you have

    function initialize(width, height) {
    width = width;
    height = height;
    }


    but it must be

    function initialize(w, h) {
    width = w;
    height = h;
    }


    There might be more, but this should get you over this problem...


    Thanks. I usually use "this" in Java but i did not find that in the online docs. So now i will use 'self' thanks

    Is it possible to get better error output from the simulator regarding the length vs length() problem?
  • Former Member
    Former Member over 10 years ago
    A thanks. i looked for this in the docs but did not find it but self is also good :-)
  • Is it possible to get better error output from the simulator regarding the length vs length() problem?


    No... The output from the simulator is not good...