No announcement yet.

Strings object touchable?

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi Mark,

    Have a look at a generated ProjectNameGCIConst.h (or .inc) file, there you see the iSomeObjectMyAlias aliases for buttons, static text, etc. objects, but not for iStrings. It would be nice to also have iStringsMyAliasName aliases output as constants so one can reference them by the alias in code, instead of having to keep a list which iStringsNumber is actually which string on the forms. For example, this is useful in the touch string example Paul posted above to identify which string was touched. Note that the iStrings aliases are not equal the string indices!

    My second request was regarding other aliases, e.g. for Magic Objects that are also not output to the ProjectNameConst.h files. So my proposal was to output all indices for all object types listed under 6.3. Genie Magic Useful Constants in the Genie Magic reference manual. This way we can easily refer to these objects by alias from the host code.




    • #17
      OK, so I took Paul's example, added a smartgauge, added aliases for it and the strings, changed the setting in File, Options, Generated Files to use aliases instead of names and I got this

      // File generated 16/07/2020 6:29:43 AM
      #define Form0 0x0A00
      #define StringsAlias 0x1100
      #define SmartFanAlias 0x2300


      • #18
        #define StringsAlias 0x1100

        As I explained above, this is an alias for tStrings (0x11 object type with index 0x00). It is not an alias for iStrings (very different values).

        Also, as explained above, aliases for some objects like magic objects are also missing: tMagicObject with object type 0x34.


        • #19
          What do you mean by iStrings? Are you referring to the message/book index? There is no alias for that in genie, if you want them you will need to define your own


          • #20
            Ok, I am trying to detect touches on Strings as in Paul's example. Therefore, I need to evaluate the passed iStrings object in my magic code in order to find out which of the many strings was actually touched. If I print out the values for those iStrings objects these look like this:
            iString1 = -30927 dec = FFFF8731 hex
            iString2 = -30901 dec = FFFF874b hex
            iString3 = -30875 dec = FFFF8765 hex

            As you can see, these numbers have nothing to do with the normal String indices (e.g. 0x1101, 0x1102, 0x1103), so I need their iStrings alias outputs. Other iObject outputs are generated in the ProjectnameGCIConst, but not for iStrings, as Paul also confirmed above, because these are not GCI objects. Other iObject aliases look like this:
            #define iLed0 0 // offset 0x0000
            #define iStatictext0 1 // offset 0x8E00

            So what I asked for is to also output these iStrings aliases somewhere so I can refer to them in code. I hope now it is clear.


            • #21
              The example I was looking at don't have any iString1,2,3, which example are you looking at?

              Regardless, these look like Flash addresses of constant strings, I can't imagine how an alias to such things could wither be an issue, or make life easier.

              Please provide some example code to make your wants/needs clearer


              • #22
                In Pauls example look at

                func StringTouched(var * strNum, var tchx, var tchy)

                and then in

                if (StringTouched(iStrings0, TouchXpos, TouchYpos))

                Instead of this iStrings0 I want to use its alias name, e.g. iMyImportantString.


                • #23
                  So iStringsxx are the addresses of the definition data for the strings.

                  If you were to create a #constant equating this to the alias name it would not always be correct, as the address will be different between RAM and Flash execution, whereas the constant created at compile time will only be correct for RAM execution.

                  So this is not possible, you will need to add some comments to your code to help you remember what is what.


                  • Anguel
                    Anguel commented
                    Editing a comment
                    I still don't understand why your compiler is not able to simply replace a cryptic iStringsXY with its more meaningful alias.
                    I am giving up on this discussion.