Announcement

Collapse
No announcement yet.

menu selection faild after scan touch

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

  • menu selection faild after scan touch

    Hi,
    We created two menus : mode 0, mode 1 with a form in Visi.
    We switch between each menu with one button (Winbutton0), but in menu mode 1, the button to go back to mode 0 doesn't display (Windbutton1). It seems that's there is problem a the outside of the touch screen scan.

    How do ? Please
    var page,x,y,numx; func main()// Uncomment the following if uSD images used. var i, state, n ; putstr("Mounting...\n"); if (!(disk:=file_Mount())) while(!(disk :=file_Mount())) putstr("Drive not mounted..."); pause(200); gfx_Cls(); pause(200); wend endif gfx_TransparentColour(0x0020); gfx_Transparency(ON); gfx_Cls(); hndl := file_LoadImageControl("test.dat", "test.gci", 1); // Form1 1.0 generated 15/04/2013 11:38:30 // Mode 0 1.0 generated 15/04/2013 11:38:30 txt_FGcolour(WHITE) ; txt_BGcolour(BLACK) ; gfx_MoveTo(100, 24) ; putstr("Mode 0") ; // Leddigits1 1.0 generated 15/04/2013 11:38:30 img_Show(hndl, iLeddigits1); // show all digits at 0, only do this once ledDigitsDisplay(numx, iLeddigits1+1, 60, 4, 1, 35, 0) ; // Winbutton1 1.0 generated 15/04/2013 11:38:30 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) ; touch_Set(TOUCH_ENABLE); // enable the touch screen repeat 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 == iWinbutton1) img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, 1); // where state is 0 for up and 1 for down img_Show(hndl,iWinbutton1) ; endif if (n == iWinbutton0) img_SetWord(hndl, iWinbutton0, IMAGE_INDEX, 1); // where state is 0 for up and 1 for down img_Show(hndl,iWinbutton0) ; endif endif //----------------------------------------------------------------------------------------- if(state == TOUCH_RELEASED) // if there's a release if (n == iWinbutton1) img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, 0); // where state is 0 for up and 1 for down img_Show(hndl,iWinbutton1) ; page := 1; // Winbutton1 1.0 generated 15/04/2013 09:44:52 img_SetWord(hndl, iWinbutton1, IMAGE_FLAGS, 0); chgpge(page); endif if (n == iWinbutton0) img_SetWord(hndl, iWinbutton0, IMAGE_INDEX, 0); // where state is 0 for up and 1 for down img_Show(hndl,iWinbutton0) ; page := 2; // Winbutton0 1.0 generated 15/04/2013 09:44:52 img_SetWord(hndl, iWinbutton0, IMAGE_FLAGS, 0); chgpge(page); endif endif //----------------------------------------------------------------------------------------- if(state == TOUCH_MOVING) // if it's moving x := touch_Get(TOUCH_GETX); y := touch_Get(TOUCH_GETY); endif foreverendfunc func chgpge(var page) var state; if(page == 1) gfx_Cls() ; // Form2 1.0 generated 15/04/2013 09:44:52 // Label1 1.0 generated 15/04/2013 09:44:52 txt_FGcolour(WHITE) ; txt_BGcolour(BLACK) ; gfx_MoveTo(100, 24) ; putstr("Mode 1") ; // Winbutton0 1.0 generated 15/04/2013 09:44:52 img_SetWord(hndl, iWinbutton0, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton0, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE); // set to enable touch, only need to do this once img_Show(hndl, iWinbutton0); // show button, only do this once endif if (page == 2) gfx_Cls() ; print(" ",x); print(" ",y); // Form1 1.0 generated 15/04/2013 14:28:22 // Mode 0 1.0 generated 15/04/2013 14:28:22 txt_FGcolour(WHITE) ; txt_BGcolour(BLACK) ; gfx_MoveTo(100, 24) ; putstr("Mode 0") ; // Leddigits1 1.0 generated 15/04/2013 14:28:22 img_Show(hndl, iLeddigits1); // show all digits at 0, only do this once ledDigitsDisplay(numx, iLeddigits1+1, 60, 4, 1, 35, 0) ; // Winbutton1 1.0 generated 15/04/2013 09:44:52 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 endif endfunc
    Vincent

  • #2


    You've set IMAGE_FLAGS to 0, which disables the button (amongst other things, really you should just set and clear individual attributes, not all the flags) and you have never reenabled the button(s), so they wont display.
    Mark

    Comment


    • #3


      ESPsupport wrote: You've set IMAGE_FLAGS to 0, which disables the button (amongst other things, really you should just set and clear individual attributes, not all the flags) and you have never reenabled the button(s), so they wont display.
      thanks. Error is position of button : button0(x,y) = button1(x,y)
      Vincent

      Comment

      Working...
      X