Announcement

Collapse
No announcement yet.

Is there a way to return a user image name rather than index?

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

  • Is there a way to return a user image name rather than index?

    First post here so before I continue thanks for producing really great products.

    Is there a way to return a user image name rather than index?

    Here is what I am trying to do (using Visi and Diablo):
    We have several programs - a boot screen loaded to flash and standalone .4XE programs loaded to the card.
    The user interface is designed with user images and many of the buttons are common to more than one program.
    The user image names are kept constant throughout the programs (e.g. the lock button is called ilock_button in all programs).

    I am now creating an interactive help .4FN program which can be called from any of the programs with file_LoadFunction.
    When this is called, touching a button brings up a help dialog specific to that button.
    This is done by loading a help.txt file which contains the name of each button followed by the help text for that button.
    Then, using str_Match, I find the name of the button, advance the pointer to the next string and print that out as the help.

    The problem is putting the name of the image touched into a string since I can't find a way to return the user image name.
    And I don't think I can use the image index instead of the name because, although the names stay the same, the image indexes change between programs depending, I think, on the order in which they were created in each program.

    At the moment I am managing to do it by using if statements, e.g.:
    if (n == ilock_button); to(buffer); putstr ("ilock_button");
    where n is the index of the image touched

    This works OK, but I'm hoping there is a neater way to do it simply by returning the name of the image touched in some way.

    Thanks for any help or pointers in the right direction.
    Jason

  • #2
    Hi Jason,

    Welcome to the community.

    When you compile your code, Workshop4 saves a string "Name property" of an object into the .dat file.
    You can create a function where you send the image index and the function will crawl into the .dat file and returns the object name.
    I attach a simple code to demonstrate how it can be implemented.

    Best regards,
    Attached Files

    Comment


    • #3
      Hi James,

      Thanks - that sounds like exactly what I need.
      I can't download the zip file though.
      I just tried downloading other files on the forum as a test and they work OK so I don't think the problem is at my end.

      Could you upload the file again?

      Kind regards
      Jason

      Comment


      • #4
        Hi James,

        Thanks - that sounds like exactly what I need.
        I can't download the zip file though.
        I just tried downloading other files on the forum as a test and they work OK so I don't think the problem is at my end.

        Could you upload the file again?

        Kind regards
        Jason

        Comment


        • #5
          If you weren't logged on when you first tried to download it you will need to press Refresh in your browser (otherwise it will keep 'using' the cached 'empty' file)
          Mark

          Comment


          • #6
            Thanks, Mark - downloaded the files OK.
            And the code worked perfectly, so thanks James for that.
            Jason

            Comment

            Working...
            X