Announcement

Collapse
No announcement yet.

Best control to use to enter digits onto the screen

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

  • Best control to use to enter digits onto the screen

    I have a requirement to be able to enter digits (i.e 1280) into a string and then use that value to make a calculation and then send via a serial port to a host.
    I am very new at using the Diablo 16 and would very much appreciate any help or guidance on where to look for examples if they exist?

    Many thanks in advance

  • #2
    I'd suggest a Keyboard object set to Numeric Keypad mode. This appnote covers the Keyboard objects: https://docs.4dsystems.com.au/app-note/4D-AN-00073

    -K

    Comment


    • #3
      Originally posted by kad View Post
      I'd suggest a Keyboard object set to Numeric Keypad mode. This appnote covers the Keyboard objects: https://docs.4dsystems.com.au/app-note/4D-AN-00073

      -K
      No. This only shows how to create a keyboard. It does not answer my question above.

      Comment


      • #4
        Good day,

        Its implementation will depend on which Workshop4 environment you are working on.

        or ViSi-genie, you will need the Pro version to at least add magic codes to your project and handle keyboard routines before sending the whole string back, you can check this example: https://forum.4dsystems.com.au/node/45934

        For ViSi and Designer, you can refer to the appnote: https://docs.4dsystems.com.au/app-note/4D-AN-00073 as suggested earlier, particularly on the "The kbHandler sub-routine" section. From there you can assemble the string before sending it via serial.

        Best Regards,

        Comment


        • #5
          Originally posted by Jerson View Post
          Good day,

          Its implementation will depend on which Workshop4 environment you are working on.

          or ViSi-genie, you will need the Pro version to at least add magic codes to your project and handle keyboard routines before sending the whole string back, you can check this example: https://forum.4dsystems.com.au/node/45934

          For ViSi and Designer, you can refer to the appnote: https://docs.4dsystems.com.au/app-note/4D-AN-00073 as suggested earlier, particularly on the "The kbHandler sub-routine" section. From there you can assemble the string before sending it via serial.

          Best Regards,
          I am using PRO and have a scenario best described if I send you my project (see attached)
          My frustration lies with being able to manipulate and use the values that end up in the string object following the KbdClr event.

          For Example.... Form 3 has a String Object (Strings8) which gets updated from the KbdClr event.

          I need to add certain features to this field such as limiting the number of digits entered and also In the Current field (Strings8), the maximum allowed entry = 25.0 and minimum = 00.0.

          Please note the decimal point

          Is there a way of checking while typing the max value as well as dynamically inserting the "." when a third digit is entered?

          i.e.. I am typing 1, 7, 3 and the display will show 17.3

          Also not allow anything > 25
          Attached Files

          Comment


          • #6
            Hi,

            Since you have a fix number of digits (3 digits), you can track your current digit position and check the key input to either accept or ignore it.

            For example: First digit input should only be 0-2, if the user pressed an incorrect digit don't store. If the first digit validates, proceed with the second digit; if the first digit is 2, it should only store 0-5, otherwise 0-9. For the dot, you can just insert it when the valid second digit is placed before proceeding to the third digit, if the 1st and 2nd digit account to a 25, it should always just be 0, otherwise allow entry for 0-9. Same with erasing values, just backtrack what was done earlier.

            Best Regards,

            Comment


            • Mick Burian
              Mick Burian commented
              Editing a comment
              My Issue is the syntax to use. Can you please help with an example of "Tracking Input"

          • #7
            Jerson, I am not sure if Paul is around but I have not heard from him and would just like to understand how to "track input" when entering values to a string object using a keyboard object.
            Can you help? Paul helped with some code (in the 1s Cut project I send to you) but I do not understand the logic, specifically the variables "RESPONSE" and "RESPCHP" used in the rMagicKbClrEvent0 function.

            Can you please assist??

            Comment


            • #8
              Hi Mick,

              I am still busy adding this feature to the code I previously sent.

              The idea is that there is an extra parameter in the WriteStr function that you can use to select a format eg "0.0" so that the number displayed would be in the correct format automatically.

              Entering 221 would place 22.1 in the string object using a format of "0.0"

              I should be finished with it by the end of my day.

              Best regards

              Paul

              Comment


              • Mick Burian
                Mick Burian commented
                Editing a comment
                Great. Thanks!

              • Mick Burian
                Mick Burian commented
                Editing a comment
                Hi Paul. Any update?

            • #9
              Originally posted by pauleilio View Post
              Hi Mick,

              I am still busy adding this feature to the code I previously sent.

              The idea is that there is an extra parameter in the WriteStr function that you can use to select a format eg "0.0" so that the number displayed would be in the correct format automatically.

              Entering 221 would place 22.1 in the string object using a format of "0.0"

              I should be finished with it by the end of my day.

              Best regards

              Paul
              Hi Paul,

              Any Update?

              Comment

              Working...
              X