Announcement

Collapse
No announcement yet.

4Dbutton1 seen as rectangle

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

  • 4Dbutton1 seen as rectangle

    Hello,

    I'm using Button01 from the widgets, the display show it as a red square with crossed 2 lines inside (x).
    What is the reason for that ?

    Thank you

  • #2
    Hi eabir40,

    This applies to all widgets, if the image index of is out of range will result an x on the display. With this, 4Dbutton01 has an image index of 0 to 3 when momentary property is set to NO or ON, 0 and 1 when momentary property is set to YES or BOTH.

    Try the application notes below as reference:

    ViSi-Genie 4D Buttons

    ViSi Winbuttons

    Hope this helps,
    Best Regards,

    Comment


    • #3
      Hi,

      Ok got it.

      Looking at the FANCYBUTTONS example on this code:

      " img_SetWord(hndl, iWinbutton1, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);"

      What is the purpose of this code part :"..... (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);" ? which replace the image_index ?

      Comment


      • #4
        Hi

        I just replaced the iWinbutton1 with the 4Dbutton1 but It doesn't pressed:

        "

        #platform "uLCD-28PTU"

        #inherit "VisualConst.inc"

        #inherit "NegDigitsConst.inc"

        #inherit "ledDigitsDisplay-ve.inc"

        #inherit "VisualConst.inc"

        //#inherit "spectrumConst.inc"

        func main()
        var numx, ch;
        var combuf[10] ;
        var bar, frame ;
        var i, x, y, state, n, Wbs1, Wbs3to5, WHITE, BLACK ;

        putstr("Mounting...\n");
        if (!(file_Mount()))
        while(!(file_Mount()))
        putstr("Drive not mounted...");
        pause(200);
        gfx_Cls();
        pause(200);
        wend
        endif
        hndl := file_LoadImageControl("NEGDIG~1.dat", "NEGDIG~1.gci", 1);
        Wbs1 := 0 ; // up, set to non zero (specifically 2) when down
        gfx_Set(SCREEN_MODE,LANDSCAPE_R);
        // Winbutton1 generated 20/12/2011 3:55:28 PM
        // 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


        //serout('Test') ; // SERIAL TEST
        to(COM0); print("serial input test:\n");
        //trout('\n');OM1); print("serial input test:\n");
        com_Init(combuf, 10, 0);


        //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_SetWord(hndl, iWinbutton1, IMAGE_INDEX, 0); // where state is 0 for up and 1 for down
        //img_Show(hndl,iWinbutton1) ;

        img_SetWord(hndl, i4Dbutton1, IMAGE_INDEX, 0); // where state is 0 for up and 1 for down
        img_Show(hndl,i4Dbutton1) ;


        // Leddigits1 1.0 generated 18/12/2014 3:37:40 PM
        img_Show(hndl, iLeddigits1); // show all digits at 0, only do this once
        // Customdigits1 1.1 generated 18/12/2014 3:37:43 PM
        img_Show(hndl, iCustomdigits1); // show all digits at 0, only do this once
        // Image1 1.0 generated 02/11/2017 12:59:13
        img_Show(hndl,iImage1) ;

        // 4Dbutton2 1.0 generated 04/11/2017 00:59:33
        img_ClearAttributes(hndl, i4Dbutton2, I_TOUCH_DISABLE); // set to enable touch, only need to do this once
        img_Show(hndl, i4Dbutton2); // show button, only do this once
        img_SetWord(hndl, i4Dbutton2, IMAGE_INDEX, state); // where state is 0 for up and 1 for down
        img_Show(hndl,i4Dbutton2) ;

        touch_Set(TOUCH_ENABLE); // enable the touch screen

        repeat
        //ch := serin();
        if(com_Count() > 1)

        ch := (serin() << 8 ) + serin();
        endif
        state := touch_Get(TOUCH_STATUS); // get touchscreen status
        n := img_Touched(hndl,-1) ;

        //if (ch != -1)
        gfx_MoveTo(0,0);
        //print( [CHR] ch ); // if a key was received from PC, print its ascii value

        numx := ch; //RAND() % 999 ;

        // Customdigits1 1.1 generated 04/11/2017 01:09:05
        img_Show(hndl, iCustomdigits1); // show all digits at 0, only do this once
        ledDigitsDisplay(numx, iiCustomdigits1, 132, 4, 1, 9, 1) ;

        // Leddigits1 1.0 generated 04/11/2017 01:09:28
        img_Show(hndl, iLeddigits1); // show all digits at 0, only do this once
        ledDigitsDisplay(numx, iLeddigits1+1, 37, 4, 1, 35, 0) ;

        //-----------------------------------------------------------------------------------------
        if(state == TOUCH_RELEASED) // if there's a release
        if (n == i4Dbutton1)
        if (Wbs1) Wbs1 := 0 ; else Wbs1 := 2 ; // toggle status
        img_SetWord(hndl, i4Dbutton1, IMAGE_INDEX, Wbs1); // where state is 0 for up, 1 for down, 2 for 'on' up and 3 for 'on' down
        img_Show(hndl,i4Dbutton1) ;
        print([DEC3ZB] 'a') ;
        // ASCII number written to the com port, or
        //serout(ch >> 8) ;
        serout('a') ;
        endif

        //-----------------------------------------------------------------------------------------
        if(state == TOUCH_MOVING) // if it's moving
        x := touch_Get(TOUCH_GETX);
        y := touch_Get(TOUCH_GETY);
        endif

        state := touch_Get(TOUCH_STATUS); // get touchscreen status
        n := img_Touched(hndl,-1) ;

        //-----------------------------------------------------------------------------------------
        if(state == TOUCH_PRESSED) // if there's a press
        x := touch_Get(TOUCH_GETX);
        y := touch_Get(TOUCH_GETY);
        if (n == i4Dbutton1)
        img_SetWord(hndl, i4Dbutton1, IMAGE_INDEX, Wbs1+1); // where state is 0 for up, 1 for down, 2 for 'on' up and 3 for 'on' down
        img_Show(hndl,i4Dbutton1);

        endif
        endif

        endif

        forever
        endfunc

        "
        Thank you











        Comment


        • #5
          Hello,

          you will need to add this line at the img_ClearAttributes(hndl, i4Dbutton1, I_TOUCH_DISABLE);

          You seem to have this for 4Dbutton2.

          Paul

          Comment


          • #6
            Hello,

            Thanks, now it works.

            Looking at the FANCYBUTTONS example on this code:

            " img_SetWord(hndl, iWinbutton1, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);"

            What is the purpose of this code part :"..... (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);" ? which replace the image_index ?

            Comment


            • #7
              Hi eabir40,

              Good Day.

              This part of the code sets the I_STAYONTOP and I_TOUCH_DISABLE bits on the IMAGE_FLAGS field of the image control entry. Please refer to the PICASO Internal Functions Reference Manual R7.0 on 2.18.6.

              Best Regards,

              Comment

              Working...
              X