Announcement

Collapse
No announcement yet.

Write Numbers/Strings to Smart Gauge

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

  • Write Numbers/Strings to Smart Gauge

    As the title suggests, I am trying to write a number to a smart gauge. The numbers can range from 1 digit to 6 digits.
    I wanted to use the Smart Gauge because then I can have a nice custom gradient background that I would be able to write a unit to, with the larger selection of fonts.
    I know I can do this with multiple layers as suggested on https://forum.4dsystems.com.au/node/62142

    Is there an easier way using the numeric part or string lookup to achieve the same outcome? And if so, how would I go about doing this?

    Something like:
    writeobjects( tSmartGauge, 0, d) where 'd' is the output from a keyboard entry?

    Or:
    to(tSmartGauge) ; putstr (d) ; ?

    Thanks for any recommendations.

  • #2
    Originally what I was doing was I had a user button, then a custom units with a bitmap over the top of that.
    The button would navigate to the keyboard page, then the keyboard entry would write to the customunits.
    If on the post activate form I set img_ClearAttributes(hndl, iCustomdigits1, I_TOUCH_DISABLE) ; then when the custom digits is pressed instead of the user button underneath, the touchscreen would freeze. To correct for this, I moved the clearattributes and setattributes to just before and after I write to the custom units. This works but when the userbutton is selected the displayed value disappears which might be fine for a home project but can't really go into a final product which this will be used in.

    Comment


    • #3
      Hi,

      I don't think writing strings on Smart Gauge will work since it is not designed to accept char/string input.

      If I may suggest, you can use UserImages which has an image of 0-Z.
      You can design each image on a graphic editor to be transparent if you need it to blend with the background.

      I have attached a sample program which uses a keyboard input and displays the result as a printed text and as an alpha-numeric image.

      I hope this can help you with your project.

      Best regards,
      Kevin
      Attached Files

      Comment


      • #4
        I see, that's unfortunate as that would have been the best solution. It would give me touch box size, font and font size and an event I can control based off of.

        Thank you for providing that code, while that would work, I need to set around 150 different parameters which would end up being at least 500 userimages I would need to cycle through.
        Using magictouch on a custom digits works great, but a big issue here is that the size of the image selected changes based upon how many units I have. So the touch box is very small when I have 2 digit variables and a decent size when I have 5 digit customdigits. I can increase the font size, but then that looks very awkward when both the 2 digit and 5 digit inputs are on the same page.

        On the attachment you can see the system 1 transducer quantity custom digits is highlighted and the box is very small. I can make it taller easily enough, but I'd really like to be able to modify the width as well.

        I just thought of something that I will try. I can make switch case statement with TouchYpos and TouchXpos to define the the area pressed. I'll see if that runs into the same issue when there is a custom digits in the same area.

        Regards,
        Justin
        Attached Files

        Comment


        • #5
          Hi Justin,

          I completely understand your concern. I just thought that you are sending a character on your Led Digit, which makes the process invalid as it is mapped to accept only integer value. That is why I suggest you create UserImage for further customization of the project.

          As you may know, the output widgets such as LedDigits/CustomDigits are not designed to have touch input.
          However, you may invoke a touch response on it be enabling its touch capability.

          You may increase the touch area of the customDigit by adjusting the size of the object, else you can create a touch area on custom digits, which I think is what you have done.

          Best Regards,
          Kevin

          Comment


          • #6
            Hi Kevin,

            Yes, the touch area is the route I ended up going with and it ended up working perfectly.
            Attached is a snip from the working code in case this helps anyone else out in the future.

            If you get a moment can you check my other post as well?
            I still haven't been able to figure out why my keyboard delete and clear buttons aren't working when I have a separate string on the same page.

            Regards,
            Justin
            Attached Files

            Comment


            • kaspervissing
              kaspervissing commented
              Editing a comment
              Hi If you see this post, then I'm very interested in a sample of your code
              I could really use a lean way to input values or strings in multiple fields like yours. I got a Form with 10 parameters inputs.. :/

          • #7
            Hi Justin,

            I am glad that you have managed to make it work.

            If you get a moment can you check my other post as well?
            This goes unnoticed, I will check and try this later on.

            Best Regards,
            Kevin

            Comment


            • #8
              Old post but since we are 2 years ahead i thought that there might be a a smarter way to do this trick?
              I could really use a simple/lean way to input values in multiple fields on the same form like this.

              Comment


              • #9
                Originally posted by kaspervissing View Post
                Old post but since we are 2 years ahead i thought that there might be a a smarter way to do this trick?
                I could really use a simple/lean way to input values in multiple fields on the same form like this.
                In your other forum post, I discussed a very simple way to implement something like this.

                The method above requires Magic which is not really necessary with the scenario you last discussed in the other thread.

                Best to keep the discussion in the other thread since, as you said, this is an old post and not necessarily the best solution now that we are 2 years ahead.

                Best Regards
                Juniel Cruz

                Comment

                Working...
                X