No announcement yet.

Modifying text in Visi buttons

  • Filter
  • Time
  • Show
Clear All
new posts

  • Modifying text in Visi buttons


    is it possible to modify the text over the buttons, when they were make using Visi?

    For example, in this button:

    // Winbutton1 1.0 generated 26/09/2012 23:35:35
    img_SetWord(hndl, iWinbutton1, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE); // set to enable touch, only need to do this once
    img_Show(hndl, iWinbutton1); // show button, only do this once
    img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, state); // where state is 0 for up and 1 for down
    img_Show(hndl,iWinbutton1) ;

    (I tried to do it with:
    img_SetWord(hndl, iWinbutton1, IMAGE_TAG, 24);
    but it does not work...)

    Another question:
    Is it possible to use the same visi button image, to show many equal buttons, when only the text over the buttons is different?


  • #2

    If there's only two text possibilities (and say two matching image possibilities) I normally add two buttons on top of each other and change the code to display the desired button.

    If there are many text possibilities I urually use a strings object and draw the text over the top immediately after displaying the button.


    • #3

      Thank you very much!

      Another question:
      Is it possible to use the same Visi button image, to show many equal buttons?

      (I would like to do it in order to save memory and to speed up the process of drawing)


      • #4

        Not quite sure what you mean there, it's not as though there is a uSD capacity issue, so that can't be it. The button lives on uSD, there's only some control information about it that really lives in memory.

        You can display the same button in multiple places by changing the IMAGE_XPOS and IMAGE_YPOS and showing it, but remember the touch will only be detected at the position it is located in at the time the img_Touched function is called


        • #5

          Ok, thanks,
          a final question:

          My program has three menus with buttons, and a calculator, so I can not draw all buttons in only "form1" (the virtual Display Module showed at the right side of the workshop), because they do not fit in so small space.

          Is it possible to make more "forms" in the same program?
          do I have to open some workshops in order to make some different *.dat and *.gci files?



          • #6

            The 'new form' button is in the 'System' Tab.

            There are some examples that use multiple forms.

            Remember to img_Disable buttons/images/etc. on the form you are leaving and img_Enable them on the for you are about to display, as touch detects any enabled control.