No announcement yet.

Multiple keyboards

  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple keyboards

    I would like to use two small Visi customized keyboards (four buttons each one) in two different screens (forms):

    When you push one button in the first keyboard, you change to the next screen, showing the second keyboard.

    I already know I have to disable the first one, before using the second keyboard.

    My question is, what is the way to disable a keyboard? Do I have to disable every buttons, one by one, or img_Disable(hndl, iKeyboard1) function is enough to do it?

    I ask it because at the beginning, the first keyboard works properly, but when I push a button and we go from the first keyboard, to the second one, it does not work (it is like blocked.. and it does not answer).

    Thanks in advance,

  • #2

    You have to disable them all.

    Actually the first image should never be enabled, it is an image of the entire keyboard, you only need to enable the invividual keys.

    If you have lots of controls it may be easier to disable ALL in one command and then use a for loop to enable a range for each form. Look inside the programnameConst.Inc file you will see that each form is grouped together.


    • #3


      is there any simple way to know the "key value" field of the touched button, in my cellphone Visi keyboard?
      or do I have to scan the (x,y) position, etc.

      I also know that if I use the function n := img_Touched(hndl,-1); ,the "n" var has the key position in the image list, starting on top and left corner, so it is possible to make a translation, but it is not very clean way to work....

      I would prefer to use a function to ask it about this field of the touched image.... something like a GettAtributes
      () function, or GetKeyValue
      really, what is the general way to read the fields of the Visi buttons of the keyboards? because the are defined by many parameters...

      thanks again,


      • #4

        The key value is calculated for you, have a look at the Keyboard sample.

        The KbHandler routine is called with the key pressed


        • #5


          I am trying to print the "" degrees symbol, at the end of the value, in the screen, but
          functions do not print it on the screen.

          It is a extended ASCII code, so, do I have to use the hexadecimal code, and other function?



          • #6

            It is an extended ASCII value, however, the internal fonts do not have extended ASCII, they only go up to 127 (0x7F).

            You can either use a uSD font (or the strings object if using ViSi), or just put an o a few pixels above where it would normally go.

            If using uSD based fonts you can putch() the hex code or even

            print([CHR] 0xB0,"C") ;


            • #7

              I have just migrated to new Workshop 4.

              Now I am trying to use[b] two small keyboards in the same Form.
              But when I write both init sequences:

              img_Show(hndl,iKeyboard4) ; // show initial keyboard 4.

              for (i := iKeyboard4+1; i


              • #8

                I created a quick test with 2 keyboards on the same form and it worked just fine.

                Does it work if you just change the code to change the keyboard shown, or do you have to force a rebuild of the GCI/DAT files?

                Regardless you are most likely running out or RAM.

                Try inserting

                #MODE RUNFLASH

                and changing destination to FLASH.


                • #9

                  Yes, I have deleted a big bitmap, which is shown at the beginning of the program (like a splash screen), and the "" font file of my project, and now it is working fine.

                  I have attached three explaining pictures.

                  Is there a way to dynamically load a bitmap from the micro-sd chip (but not included in the GCI/DAT files), and when you dont need it anymore,then to delete it from RAM?. That way, I could still show this bmp when the program starts.....

                  (Something like malloc() and delete() memory in C, more or less.... with so small RAM it would be very useful for me)

                  Thanks in advance, Attached files


                  • #10

                    That would still use way to much RAM.

                    Why not have it in separate .GCI? and just open, display, and close it


                    • #11

                      you told me: "just open, display, and close it"

                      I know the way to open and display the resource:

                      // Load resource from micro-SD.
                      hndl := file_LoadImageControl("TESTRA~1.dat", "TESTRA~1.gci", 0);

                      gfx_Cls() ;

                      // Image1 1.0 generated 17/10/2012 13:55:53
                      img_Show(hndl,iImage1) ;

                      But, what is the way to close it?



                      • #12

                        mem_Free(hndl) ;

                        You could also open it as a file_Image(...), that would probably be slightly more efficient, although if the image wasn't at the start of the file you'd have to hardcode a file_Seek() to get to it


                        • #13

                          Thanks for your answer,

                          I hope my next question will be my last question, in some days:

                          I am implementing a Send Commands function, in order to send command from the display to my PCB board through the I2C bus (Function is under construction...):

                          // Send command to PCB board.
                          func SendCommand(var CommandHead, var data1)

                          // To build the command.
                          datatosend[0] := LObyte(CommandHead);
                          datatosend[1] := LObyte(data1);
                          datatosend[2] := HIbyte(data1);
                          datatosend[3] := 0;
                          datatosend[4] := 0;

                          // Send command by bus I2C.
                          I2C_Putn(datatosend , COMMAND_SIZE);

                          Each command has a head (1 byte) and 4 bytes of data. Total, I have to send 5 bytes.

                          but I can not find the way to define a bytes array in RAM.

                          I need it to declare "datatosend" variable, as an array of bytes.

                          Is there a way to do it?


                          • #14

                            I2C_Putn expects a byte array stored as a word aligned array.

                            So, each array element is actually 2 bytes packed.

                            Possibly easies way if you need to access as non word aligned is:-

                            var p;

                            p := str_Ptr(datatosend); // raise a string pointer to the buffer

                            str_PutByte(p, CommandHead); // write LO byte of command
                            str_PutWord(p+1, data1); // write data1 word
                            str_PutWord(p+3, 0); // write zero word

                            Name="Default Paragraph Font"/> iority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/> xception Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/> t 1 Accent 6"/>


                            • #15


                              and then, "datatosend" must be simply declared as

                              var datatosend[5];


                              var datatosend:= mem_Allocz(5);

                              I think is the same, excepting the necessary mem_Free(datatosend) in the last option, of course.