No announcement yet.

Writing to string object from keyboard without host

  • Filter
  • Time
  • Show
Clear All
new posts

  • Writing to string object from keyboard without host

    Hi i have been trying to implement a name entry facility using a string object and keyboard without success, I basically just want to type the name on the keyboard and get it to display on a String object and stay there until i change it, I am not using an external host just trying to implement it on the screens processor.

    I am using a magic keyboard event to take in the characters and use the following to print to the string object

    PrintStrings(0,Response,1); // Response being a pointer to a word array

    However it only prints the 1st,3rd,5th etc character, I know this is to do with the way characters are stored in the array in a high and low byte but i am having trouble overcoming this issue.
    Last edited by ian79; 14th April 2017, 01:17 AM.

  • #2
    It looks like you are confusing strings with integer arrays.

    Have a look at the File, Samples, ViSi Genie Magic, KeyboardEdit sample and see how that does it.


    • #3
      Hi Mark

      I have used that exact app note to great effect to implement a pin pad password, I have also used it to update an led digit by entering numbers to the keypad it has been a valuable resource

      I have tried to use this same app note again to use keypad entry to write to a string object but it is not working, I can enter the characters and they will display above the keyboard but if I try to print them to a string object on another form it doesn't work as i mentioned above it only prints the 1st, 3rd, 5th characters.

      In the app note ViSi Genie Magic, KeyboardEdit there there is a global variable "var Response[3]" that stores the keyboard entry value, I have increased this in size and used this as my second parameter to send to the PrintStrings function but i am not sure this is correct. eg PrintStrings(0,Response,1).

      The reference manual says that the second parameter of the PrintStrings function should be a "Pointer to word array being a unicode string for dynamic strings"

      Its probably my lack of understanding of that description that is causing my difficulty..


      • #4
        A string object uses an array of integers (unicode string), not an ANSI string. To print to a string object from a real string it needs to be converted.

        Have a look at the ANSI2Uni function in MagicEvent1 in the in post #4 here


        • #5
          Great Ansi2Uni sounds like what i'm looking for



          • #6
            Hi Mark

            The ANSI2Uni function worked perfectly for the application and I can now enter text via a keyboard on form 16 and get it to display on a string object in form 0, thanks for that link

            As I have said earlier i have used the ViSi Genie Magic, KeyboardEdit app note as a base for my keyboard entry, this app note uses the putch(value) to display the inputted characters on the screen on form 16 (above the keyboard)

            I am using PrintStrings() to print the inputted characters to the string object on form 0 this is populated every time form 0 is activated.

            my question now is what is the correct way to change my fonts on the string object on form 0, I have noticed that if i change the font type to anything other than 4DFont3 8X12 on the strings editor the font works fine on the string object but I loose my character display above the keyboard when i type.

            I don't understand why changing font on a string object on form 1 affects the putch(value) character display on form 16 maybe you can shed some light on this



            • #7

              Attached is a modified Visi-Genie Magic of the Keyboard Edit project. It accepts the Pin code and displays it at a different and bigger font on Form1.
              It also has the corrected version of ANSI2Uni function so it will work on array variables. Before, it only work on String constants. It also uses the
              txt_FontID(4) ; to vary the font. The font of the string in Form1 is set on the strings property
              Attached Files


              • #8
                Thanks for that
                I downloaded that file and unzipped it but when I try to open it in workshop I get a warning "Unknown parameter alignment for object statictext0" and it wont open the program I tried downloading it twice just to be sure.


                • #9
                  Hi Ian,

                  I have just tried it and it works fine, what version of Workshop are you using.
                  Can you try updating to latest version

                  Best regards



                  • #10
                    workshop PRO version even went through update procedure but still doesn't work.


                    • #11
                      Please try the attached (replace the KeyboardEdit-ver2.4DGenie with the one in the earlier zip)

                      We have a newer version of Workshop undergoing internal testing that has an additional parameter for static text objects
                      Attached Files


                      • #12
                        Thanks This worked,

                        Support here is great, gives great confidence when considering using 4D systems screens in future projects.

                        keep up the good work!