Announcement

Collapse
No announcement yet.

Strings object touchable?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anguel
    commented on 's reply
    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.

  • ESPsupport
    replied
    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.

    Leave a comment:


  • Anguel
    replied
    In Pauls example look at MagicCode0.inc:

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

    and then in MagicTouch.inc:

    if (StringTouched(iStrings0, TouchXpos, TouchYpos))

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

    Leave a comment:


  • ESPsupport
    replied
    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

    Leave a comment:


  • Anguel
    replied
    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.

    Leave a comment:


  • ESPsupport
    replied
    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

    Leave a comment:


  • Anguel
    replied
    #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.

    Leave a comment:


  • ESPsupport
    replied
    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

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

    Leave a comment:


  • Anguel
    replied
    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.

    Thanks,

    Anguel

    Leave a comment:


  • ESPsupport
    replied
    Exactly where are the wrong constants generated?

    It all seems to work as far as I can see

    Leave a comment:


  • Anguel
    commented on 's reply
    Great! Thanks!

  • ESPsupport
    replied
    Thanks for reporting this, we will ensure it is fixed for the next Workshop release.

    Leave a comment:


  • Anguel
    replied
    I see, that magic object aliases are also not output to the constants files. Why don't you just output all indices for all object types listed under
    6.3. Genie Magic Useful Constants
    This way the user can make use of all alias names he has defined in Workshop and does not have to rely on numeric indices that may change from project to project or even inside a project.

    Leave a comment:


  • Anguel
    replied
    Hi Paul,

    Thanks, I think it would be a great idea to be able to somehow access the alias names for strings from code. Working with and maintaining the internal string names on multiple forms is much additional work and often leads to confusion.

    Thanks,
    Anguel

    Leave a comment:


  • pauleilio
    replied
    Hi Anguel,

    The Strings object is handled differently as it isn't a GCI object but I will certainly have a look into it.

    Best regards

    Paul

    Leave a comment:

Working...
X