Announcement

Collapse
No announcement yet.

img_Touched function

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

  • img_Touched function

    hi,

    i m designing 4D Visi application for my user interface with uLCD-32PT.

    i m using img_Touched function to know which button is pressed. However it does not work as expected mainly touch detect can not be sensed.

    hndl :=file_LoadImageControl("dnm.dat","dnm.gci",1);

    touch_Set(TOUCH_ENABLE)

    repeat

    touchState:=touch_Get(TOUCH_STATUS)

    if(touchState==TOUCH_PRESSED)
    n:=img_Touched(hndl,-1);
    if(n!=-1)
    if(n==iWinbutton1)
    Initialize();
    endif
    if(n==,Winbutton2)
    RetunMain();
    endif
    endif
    endif
    forever

    I m checking demo codes and they all works fine. I m exactly using the same get_Touch and img_Touched functions but mine stops at a point around 4 level of menu. The only major difference between mine and demo codes are i used a few different forms in 4D visi project.

    I really get crazy since this easy job took a lot of time.

    Why tehere is no feedback on this topic. I have limited time to finalize my user interface task. Menu works well but touch screen stops working after a few touch or it does not sense button img with img_touched function. Help please

    by the way i both tested with functions and subfunction without success.

    regards,
    Serkan

  • #2


    there does not look anything wrong there - apart from the , in front of Winbutton2 - post all your code (or zip and attach) and I will have a look

    Comment


    • #3


      I think img_touched function can not catch image touched all the time. Detailed explanation needed for this function.

      Regards,
      Serkan

      Comment


      • #4


        If you think there is a problem please post some sample code that demonstrates it and a description of what you perceive the problem as.

        We are not aware of any issue.
        Mark

        Comment


        • #5


          I use it in a project without any problems - post code as I said last week

          Comment


          • #6

            Try the following code and use some menus on it. You will see image touch is not sensed after awhile.

            #platform "uLCD-32PT_GFX2"

            #inherit "4DGL_16bitColours.fnc"

            #inherit "VisualConst.inc"

            #inherit "NtdsEthGuiConst.inc"

            var hstrings ;
            var hFontx ;
            var hFontn;
            var state;
            var on;
            var res;
            var private touchState; // window touch status
            var private touchX; // window x position
            var private touchY; // window y position
            var n;
            var GERIFLG:=1;
            var TXFLG:=0;
            var private NTDSKURULUMFLG:=1;
            var private NTDSTESTFLG:=1;
            var private IPKURULUMFLG:=1;
            var private NTDSMODEFLG:=1;
            var private DLPBCKFLG:=1;
            var private HLPBCKFLG:=1;
            var private CIT:=0;
            var private Ihndl:=0;

            // ============== MAIN FUNCTION ==================
            // ===============================================

            func main()

            gfx_Set(SCREEN_MODE,LANDSCAPE) ;

            touch_Set(TOUCH_ENABLE);

            putstr("Mounting...\n");

            if (!(disk:=file_Mount()))
            while(!(disk :=file_Mount()))
            putstr("Drive not mounted...");
            pause(200);
            gfx_Cls();
            pause(200);
            wend
            endif

            putstr("File Mounted\n");

            gfx_TransparentColour(0x0020);
            gfx_Transparency(ON);

            hndl := file_LoadImageControl("NTDSET~1.dat", "NTDSET~1.gci", 1);

            repeat // forever loop (FORM-1)

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_SetWord(hndl, iWinbutton1, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton1);
            img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton1) ;

            img_SetWord(hndl, iWinbutton2, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton2, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton2);
            img_SetWord(hndl, iWinbutton2, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton2) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton1)
            NtdsKurulum();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton2)
            NtdsTest();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif
            endif
            forever
            endfunc

            func NtdsKurulum () // NTDS KURULUM Functions (FORM-2) =======================================

            NTDSKURULUMFLG:=1;

            repeat

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_Show(hndl,iStatictext1) ;

            img_SetWord(hndl, iWinbutton3, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton3, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton3);
            img_SetWord(hndl, iWinbutton3, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton3) ;

            img_SetWord(hndl, iWinbutton4, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton4, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton4);
            img_SetWord(hndl, iWinbutton4, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton4) ;

            img_SetWord(hndl, iWinbutton5, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton5, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton5);
            img_SetWord(hndl, iWinbutton5, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton5) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton3)
            IpKurulum();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton4)
            NtdsMode();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton5)
            NTDSKURULUMFLG:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            endif

            until (NTDSKURULUMFLG==0);

            endfunc

            func IpKurulum()

            IPKURULUMFLG:=1;

            repeat

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_Show(hndl,iStatictext3) ;

            img_SetWord(hndl, iWinbutton10, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton10, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton10);
            img_SetWord(hndl, iWinbutton10, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton10) ;

            img_SetWord(hndl, iWinbutton11, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton11, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton11);
            img_SetWord(hndl, iWinbutton11, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton11) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton10) // IP Kurulum - Gonder
            gfx_Cls();
            gfx_MoveTo(50,50);
            TXFLG:=0x01;
            txt_Bold(1);
            putstr("YENI IP ADRESI AYARLANDI !");
            pause(3000);
            txt_Bold(0);
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton11) // IP Kurulum - Geri
            IPKURULUMFLG:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            endif

            until (IPKURULUMFLG==0);

            endfunc

            func NtdsMode()

            NTDSMODEFLG:=1;

            repeat

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_Show(hndl,iStatictext4) ;

            img_SetWord(hndl, iWinbutton12, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton12, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton12);
            img_SetWord(hndl, iWinbutton12, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton12) ;

            img_SetWord(hndl, iWinbutton13, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton13, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton13);
            img_SetWord(hndl, iWinbutton13, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton13) ;

            img_SetWord(hndl, iWinbutton14, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton14, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton14);
            img_SetWord(hndl, iWinbutton14, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton14) ;

            img_SetWord(hndl, iWinbutton15, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton15, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton15);
            img_SetWord(hndl, iWinbutton15, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton15) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton12) // Ntds Mode - Computer
            gfx_Cls();
            gfx_MoveTo(50,50);
            TXFLG:=0x01;
            txt_Bold(1);
            putstr("NTDS COMPUTER OLARAK AYARLANDI !");
            txt_Bold(0);
            pause(3000);
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton13) // Ntds Mode - Peripheral
            gfx_Cls();
            gfx_MoveTo(50,50);
            TXFLG:=0x01;
            txt_Bold(1);
            putstr("NTDS PERIPHERAL OLARAK AYARLANDI !");
            txt_Bold(0);
            pause(3000);
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton14) // Ntds Mode - Intercomputer
            gfx_Cls();
            gfx_MoveTo(50,50);
            TXFLG:=0x01;
            txt_Bold(1);
            putstr("NTDS INTERCOMPUTER OLARAK AYARLANDI !");
            txt_Bold(0);
            pause(3000);
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton15) // Ntds Mode - Geri Dönüş
            NTDSMODEFLG:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            endif

            until (NTDSMODEFLG==0);

            endfunc

            func NtdsTest () // NTDS TEST Functions ( FORM-3 ) =========================================

            NTDSTESTFLG:=1;

            repeat

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_Show(hndl,iStatictext2) ;

            img_SetWord(hndl, iWinbutton6, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton6, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton6);
            img_SetWord(hndl, iWinbutton6, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton6) ;

            img_SetWord(hndl, iWinbutton7, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton7, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton7);
            img_SetWord(hndl, iWinbutton7, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton7) ;

            img_SetWord(hndl, iWinbutton8, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton8, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton8);
            img_SetWord(hndl, iWinbutton8, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton8) ;

            img_SetWord(hndl, iWinbutton9, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton9, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton9);
            img_SetWord(hndl, iWinbutton9, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton9) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton6)
            DahiliLoopback();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton7)
            HariciLoopback();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton8)
            CihaziciTest();
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton9)
            NTDSTESTFLG:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            endif

            until (NTDSTESTFLG==0);

            endfunc

            func DahiliLoopback()

            DLPBCKFLG:=1;

            repeat

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_Show(hndl,iStatictext5) ;

            img_Show(hndl,iUserled1) ;
            img_SetWord(hndl, iUserled1, IMAGE_INDEX, on);
            img_Show(hndl,iUserled1) ;

            img_SetWord(hndl, iWinbutton16, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton16, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton16);
            img_SetWord(hndl, iWinbutton16, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton16) ;

            img_SetWord(hndl, iWinbutton17, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton17, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton17);
            img_SetWord(hndl, iWinbutton17, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton17) ;

            img_Show(hndl,iUserled2) ;
            img_SetWord(hndl, iUserled2, IMAGE_INDEX, on);
            img_Show(hndl,iUserled2) ;

            img_Show(hndl,iUserled3) ;
            img_SetWord(hndl, iUserled3, IMAGE_INDEX, on);
            img_Show(hndl,iUserled3) ;

            img_Show(hndl,iUserled4) ;
            img_SetWord(hndl, iUserled4, IMAGE_INDEX, on);
            img_Show(hndl,iUserled4) ;

            img_Show(hndl,iUserled5) ;
            img_SetWord(hndl, iUserled5, IMAGE_INDEX, on);
            img_Show(hndl,iUserled5) ;

            img_Show(hndl,iUserled6) ;
            img_SetWord(hndl, iUserled6, IMAGE_INDEX, on);
            img_Show(hndl,iUserled6) ;

            img_Show(hndl,iUserled7) ;
            img_SetWord(hndl, iUserled7, IMAGE_INDEX, on);
            img_Show(hndl,iUserled7) ;

            img_Show(hndl,iUserled8) ;
            img_SetWord(hndl, iUserled8, IMAGE_INDEX, on);
            img_Show(hndl,iUserled8) ;

            img_Show(hndl,iUserled9) ;
            img_SetWord(hndl, iUserled9, IMAGE_INDEX, on);
            img_Show(hndl,iUserled9) ;

            img_Show(hndl,iUserled10) ;
            img_SetWord(hndl, iUserled10, IMAGE_INDEX, on);
            img_Show(hndl,iUserled10) ;

            img_Show(hndl,iUserled11) ;
            img_SetWord(hndl, iUserled11, IMAGE_INDEX, on);
            img_Show(hndl,iUserled11) ;

            img_Show(hndl,iUserled12) ;
            img_SetWord(hndl, iUserled12, IMAGE_INDEX, on);
            img_Show(hndl,iUserled12) ;

            img_Show(hndl,iUserled13) ;
            img_SetWord(hndl, iUserled13, IMAGE_INDEX, on);
            img_Show(hndl,iUserled13) ;

            img_Show(hndl,iUserled14) ;
            img_SetWord(hndl, iUserled14, IMAGE_INDEX, on);
            img_Show(hndl,iUserled14) ;

            img_Show(hndl,iUserled15) ;
            img_SetWord(hndl, iUserled15, IMAGE_INDEX, on);
            img_Show(hndl,iUserled15) ;

            img_Show(hndl,iUserled16) ;
            img_SetWord(hndl, iUserled16, IMAGE_INDEX, on);
            img_Show(hndl,iUserled16) ;

            img_Show(hndl,iUserled17) ;
            img_SetWord(hndl, iUserled17, IMAGE_INDEX, on);
            img_Show(hndl,iUserled17) ;

            img_Show(hndl,iUserled18) ;
            img_SetWord(hndl, iUserled18, IMAGE_INDEX, on);
            img_Show(hndl,iUserled18) ;

            img_Show(hndl,iUserled19) ;
            img_SetWord(hndl, iUserled19, IMAGE_INDEX, on);
            img_Show(hndl,iUserled19) ;

            img_Show(hndl,iUserled20) ;
            img_SetWord(hndl, iUserled20, IMAGE_INDEX, on);
            img_Show(hndl,iUserled20) ;

            img_Show(hndl,iUserled21) ;
            img_SetWord(hndl, iUserled21, IMAGE_INDEX, on);
            img_Show(hndl,iUserled21) ;

            img_Show(hndl,iUserled22) ;
            img_SetWord(hndl, iUserled22, IMAGE_INDEX, on);
            img_Show(hndl,iUserled22) ;

            img_Show(hndl,iUserled23) ;
            img_SetWord(hndl, iUserled23, IMAGE_INDEX, on);
            img_Show(hndl,iUserled23) ;

            img_Show(hndl,iUserled24) ;
            img_SetWord(hndl, iUserled24, IMAGE_INDEX, on);
            img_Show(hndl,iUserled24) ;

            img_Show(hndl,iUserled25) ;
            img_SetWord(hndl, iUserled25, IMAGE_INDEX, on);
            img_Show(hndl,iUserled25) ;

            img_Show(hndl,iUserled26) ;
            img_SetWord(hndl, iUserled26, IMAGE_INDEX, on);
            img_Show(hndl,iUserled26) ;

            img_Show(hndl,iUserled27) ;
            img_SetWord(hndl, iUserled27, IMAGE_INDEX, on);
            img_Show(hndl,iUserled27) ;

            img_Show(hndl,iUserled28) ;
            img_SetWord(hndl, iUserled28, IMAGE_INDEX, on);
            img_Show(hndl,iUserled28) ;

            img_Show(hndl,iUserled29) ;
            img_SetWord(hndl, iUserled29, IMAGE_INDEX, on);
            img_Show(hndl,iUserled29) ;

            img_Show(hndl,iUserled30) ;
            img_SetWord(hndl, iUserled30, IMAGE_INDEX, on);
            img_Show(hndl,iUserled30) ;

            img_Show(hndl,iUserled31) ;
            img_SetWord(hndl, iUserled31, IMAGE_INDEX, on);
            img_Show(hndl,iUserled31) ;

            img_Show(hndl,iUserled32) ;
            img_SetWord(hndl, iUserled32, IMAGE_INDEX, on);
            img_Show(hndl,iUserled32) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton16) // Dahili Loopback - Başlat
            gfx_Cls();
            gfx_MoveTo(50,50);
            TXFLG:=0x01;
            txt_Bold(1);
            putstr("NTDS LOOPBACK TEST BAŞLATILDI !");
            txt_Bold(0);
            pause(3000);
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton17) // Dahili Loopback - Geri Dönüş
            DLPBCKFLG:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            endif

            until (DLPBCKFLG==0);

            endfunc

            func HariciLoopback()

            HLPBCKFLG:=1;

            repeat

            gfx_BGcolour(DODGERBLUE) ;
            gfx_Cls() ;

            img_Show(hndl,iStatictext6) ;

            img_SetWord(hndl, iWinbutton18, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton18, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton18);
            img_SetWord(hndl, iWinbutton18, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton18) ;

            img_SetWord(hndl, iWinbutton19, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton19, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE);
            img_Show(hndl, iWinbutton19);
            img_SetWord(hndl, iWinbutton19, IMAGE_INDEX, state);
            img_Show(hndl,iWinbutton19) ;

            img_Show(hndl,iUserled33) ;
            img_SetWord(hndl, iUserled33, IMAGE_INDEX, on);
            img_Show(hndl,iUserled33) ;

            img_Show(hndl,iUserled34) ;
            img_SetWord(hndl, iUserled34, IMAGE_INDEX, on);
            img_Show(hndl,iUserled34) ;

            img_Show(hndl,iUserled35) ;
            img_SetWord(hndl, iUserled35, IMAGE_INDEX, on);
            img_Show(hndl,iUserled35) ;

            img_Show(hndl,iUserled36) ;
            img_SetWord(hndl, iUserled36, IMAGE_INDEX, on);
            img_Show(hndl,iUserled36) ;

            img_Show(hndl,iUserled37) ;
            img_SetWord(hndl, iUserled37, IMAGE_INDEX, on);
            img_Show(hndl,iUserled37) ;

            img_Show(hndl,iUserled38) ;
            img_SetWord(hndl, iUserled38, IMAGE_INDEX, on);
            img_Show(hndl,iUserled38) ;

            img_Show(hndl,iUserled39) ;
            img_SetWord(hndl, iUserled39, IMAGE_INDEX, on);
            img_Show(hndl,iUserled39) ;

            img_Show(hndl,iUserled40) ;
            img_SetWord(hndl, iUserled40, IMAGE_INDEX, on);
            img_Show(hndl,iUserled40) ;

            img_Show(hndl,iUserled41) ;
            img_SetWord(hndl, iUserled41, IMAGE_INDEX, on);
            img_Show(hndl,iUserled41) ;

            img_Show(hndl,iUserled42) ;
            img_SetWord(hndl, iUserled42, IMAGE_INDEX, on);
            img_Show(hndl,iUserled42) ;

            img_Show(hndl,iUserled43) ;
            img_SetWord(hndl, iUserled43, IMAGE_INDEX, on);
            img_Show(hndl,iUserled43) ;

            img_Show(hndl,iUserled44) ;
            img_SetWord(hndl, iUserled44, IMAGE_INDEX, on);
            img_Show(hndl,iUserled44) ;

            img_Show(hndl,iUserled45) ;
            img_SetWord(hndl, iUserled45, IMAGE_INDEX, on);
            img_Show(hndl,iUserled45) ;

            img_Show(hndl,iUserled46) ;
            img_SetWord(hndl, iUserled46, IMAGE_INDEX, on);
            img_Show(hndl,iUserled46) ;

            img_Show(hndl,iUserled47) ;
            img_SetWord(hndl, iUserled47, IMAGE_INDEX, on);
            img_Show(hndl,iUserled47) ;

            img_Show(hndl,iUserled48) ;
            img_SetWord(hndl, iUserled48, IMAGE_INDEX, on);
            img_Show(hndl,iUserled48) ;

            img_Show(hndl,iUserled49) ;
            img_SetWord(hndl, iUserled49, IMAGE_INDEX, on);
            img_Show(hndl,iUserled49) ;

            img_Show(hndl,iUserled50) ;
            img_SetWord(hndl, iUserled50, IMAGE_INDEX, on);
            img_Show(hndl,iUserled50) ;

            img_Show(hndl,iUserled51) ;
            img_SetWord(hndl, iUserled51, IMAGE_INDEX, on);
            img_Show(hndl,iUserled51) ;

            img_Show(hndl,iUserled52) ;
            img_SetWord(hndl, iUserled52, IMAGE_INDEX, on);
            img_Show(hndl,iUserled52) ;

            img_Show(hndl,iUserled53) ;
            img_SetWord(hndl, iUserled53, IMAGE_INDEX, on);
            img_Show(hndl,iUserled53) ;

            img_Show(hndl,iUserled54) ;
            img_SetWord(hndl, iUserled54, IMAGE_INDEX, on);
            img_Show(hndl,iUserled54) ;

            img_Show(hndl,iUserled55) ;
            img_SetWord(hndl, iUserled55, IMAGE_INDEX, on);
            img_Show(hndl,iUserled55) ;

            img_Show(hndl,iUserled56) ;
            img_SetWord(hndl, iUserled56, IMAGE_INDEX, on);
            img_Show(hndl,iUserled56) ;

            img_Show(hndl,iUserled57) ;
            img_SetWord(hndl, iUserled57, IMAGE_INDEX, on);
            img_Show(hndl,iUserled57) ;

            img_Show(hndl,iUserled58) ;
            img_SetWord(hndl, iUserled58, IMAGE_INDEX, on);
            img_Show(hndl,iUserled58) ;

            img_Show(hndl,iUserled59) ;
            img_SetWord(hndl, iUserled59, IMAGE_INDEX, on);
            img_Show(hndl,iUserled59) ;

            img_Show(hndl,iUserled60) ;
            img_SetWord(hndl, iUserled60, IMAGE_INDEX, on);
            img_Show(hndl,iUserled60) ;

            img_Show(hndl,iUserled61) ;
            img_SetWord(hndl, iUserled61, IMAGE_INDEX, on);
            img_Show(hndl,iUserled61) ;

            img_Show(hndl,iUserled62) ;
            img_SetWord(hndl, iUserled62, IMAGE_INDEX, on);
            img_Show(hndl,iUserled62) ;

            img_Show(hndl,iUserled63) ;
            img_SetWord(hndl, iUserled63, IMAGE_INDEX, on);
            img_Show(hndl,iUserled63) ;

            img_Show(hndl,iUserled64) ;
            img_SetWord(hndl, iUserled64, IMAGE_INDEX, on);
            img_Show(hndl,iUserled64) ;

            touchState:=0;touchX:=0;touchY:=0;n:=-5;

            while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

            n:=img_Touched(hndl,-1);

            touchX := touch_Get(TOUCH_GETX);
            touchY := touch_Get(TOUCH_GETY);

            if(n != -1)

            if (n==iWinbutton18) // Harici Loopback - Başlat
            gfx_Cls();
            gfx_MoveTo(50,50);
            TXFLG:=0x01;
            txt_Bold(1);
            putstr("NTDS LOOPBACK TEST BAŞLATILDI !");
            txt_Bold(0);
            pause(3000);
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            if (n==iWinbutton19) // Harici Loopback - Geri Dönüş
            HLPBCKFLG:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endif

            endif

            until (HLPBCKFLG==0);

            endfunc

            func CihaziciTest()
            CIT:=0;
            touchState:=0;touchX:=0;touchY:=0;n:=-5;
            endfunc
            Serkan

            Comment


            • #7


              You need to zip up and include the .4dg code, the .4dvisi code and the .imgdata folder and its contents before we can actually see what you are trying to do.
              Mark

              Comment


              • #8


                i will really get crazy with this . I already completed my previous user interface project without using it. instead, i used touch_get only and scanned area. But this takes long time.

                Now i m building another user interface for another device. I m looking thourough the forum and see no bady complains about it altough i exactly write the same code. May be projet structure affects it. My project has a few different functions and every functions corresponds to a forum of visi application. first i tried using img_touched with -1 parameter it resulted with same error: after a few touch it starts not sensing of my buttons. it infacts senses the touch since refreshes the screen but does not hit any butoon. Now i tried another way and called with button number but now it goes blank screen after 15 correct touch and give error 15 PC=3467, V1=0, V2=0. I m checking the meaning of it seeing EVE stack overflow. what is the meaning of it?

                I mean;

                using following way was causing not to sense buttons after a few touch;

                while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

                touchX := touch_Get(TOUCH_GETX);
                touchY := touch_Get(TOUCH_GETY);

                n:=img_Touched(hndl,-1);

                if(n != -1)
                if (n==iWinbutton16)
                AnaMenu();
                endif
                endif

                but using following way actually sense the button and goes to correct function however, gives error 15 after 15-20 touch;

                while(touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);

                touchX := touch_Get(TOUCH_GETX);
                touchY := touch_Get(TOUCH_GETY);

                if(img_Touched(hndl,iWinbutton16)==iWinbutton16)
                AnaMenu();
                endif

                Could you please help a little more to overcome this issue?

                Best regards,
                Serkan

                Comment


                • #9


                  Looping until a touch is pressed is not a good idea, a) you will not be able to process any background activity, b) if you haven't seen a release you might end up doouble processing, c) if the response is touch moving you might be getting lost. Look at the way the samples do it.

                  The only way I can imaging your first code failing is if you have multiple forms and have them all enabled. The touch that will be detected will be the lowest index. You can debug yout code by printing n when it is not -1. Regardless remember to disable touches for images on other forms when they are not meant to be active. Also remember that just because you have overwritten an image doesn't mean it wont be detected.

                  From Appendix B of the internal functions manual you can see that error 15 is a stack overflow. In this case it is almost certainly caused by program recursion. Are you calling main from AnaMenu(), rather than returning, or somrthing similar?
                  Mark

                  Comment


                  • #10


                    Hi,

                    Continously check for a touch comes from expreince. I was doing some backround jobs then check the button touch and saw that sometimes touches are not sensed unless checking it continously. That is why i m using continous check of touch detect. It indeed worked well without any problem in my first user interface.

                    For first code, i think you mean, the application senses touch for first forum even if i touch anything in other forums rigth? So whatever i need is disabling the forums that are not on the screen. But when i put all codes into the project there is no codes for forms. So i dont have any idea about how to disable other forums.

                    For the second function, i m calling AnaMenu from main and some other functions from AnaMenu. But other functions only calls to the AnaMenu without returning or function ending. I mean;

                    AnaMenu (){
                    ..
                    FirtFunction();

                    }

                    FirstFunction(){

                    ...
                    AnaMenu();
                    ...
                    }

                    SecondFunction(){

                    ...
                    AnaMenu();
                    ...
                    }

                    I think problem is not returning from the function and EVE puts status register and pc value into stact when a function is called. It causes stact overflow because i never return any function. I will use return key or function end to release stuck.

                    Best regards,
                    Serkan

                    Comment


                    • #11


                      You need to write some code to disable the images in other forms and enable the ones in the current form. It may be something like

                      func SetForm(var newform)
                      img_Disable(hndl, ALL);
                      curform := newform ;
                      if (curform == 1)
                      EnaShow(iForm1);
                      ShowBbutton() ;
                      ShowPbutton() ;
                      txt_FontID(hFont1) ; // Font index correct at time of code generation
                      txt_FGcolour(WHITE) ;
                      txt_BGcolour(0x39E7) ;
                      gfx_MoveTo(10 , 16) ;
                      print("MODE:") ;
                      ShowMmessage() ;
                      ShowEtemp() ;
                      ShowRtemp() ;
                      ShowItemp() ;
                      ShowStempForm1() ;
                      else if (curform == 2)
                      EnaShow(iForm2);
                      EnaShow(iWinbutton4) ;
                      EnaShow(iWinbutton5) ;
                      EnaShow(iWinbutton6) ;
                      EnaShow(iStatictext1) ;
                      EnaShow(iStatictext2) ;
                      EnaShow(iStatictext3) ;
                      ShowBbutton() ;
                      ShowPbutton() ;
                      ShowStempForm2() ;
                      endif
                      endfunc

                      Or if, your forms are more 'complicated', you might like to use the fact that all forms and images are in sequence as far as their iName is concerned, eg for the above the programConst.inc file has this in it

                      #CONST
                      iForm1 // offset 0x0
                      iWinbutton1 // offset 0x25A00
                      iWinbutton2 // offset 0x2AC00
                      iWinbutton3 // offset 0x2FE00
                      iWinbutton7 // offset 0x35000
                      iWinbutton8 // offset 0x3A200
                      iForm2 // offset 0x3F400
                      iStatictext1 // offset 0x64E00
                      iStatictext2 // offset 0x66A00
                      iStatictext3 // offset 0x67400
                      iWinbutton4 // offset 0x67C00
                      iWinbutton5 // offset 0x6BA00
                      iWinbutton6 // offset 0x6F800
                      #END

                      You could use a loop to enable and show iForm1 to iWinbutton8 to 'enable' form1 and another from iForm2 to iWinbutton6 to enable form2
                      Mark

                      Comment


                      • #12


                        one thing comes to my mind;

                        if the reason of not sensing touch when using n:=img_Touched(hndl,-1); is ralated with enableing/disabling forms how come img_Touched(hndl,iWinbutton16)==iWinbutton16 works altough it walks trough all forms?

                        Best regards,
                        Serkan

                        Comment


                        • #13


                          Is EnaShow an internal 4dgl function? because i can't find any more references to such a function.

                          And also i am having the same issue as Tamirci, i can't get any code for the forms. If i look into the programConst.inc file, there is no such thing as iForm1.

                          Can you please help me, because i would find very useful to disable and enable forms efficiently.

                          thanks

                          ESPsupport wrote: You need to write some code to disable the images in other forms and enable the ones in the current form. It may be something like

                          func SetForm(var newform)
                          img_Disable(hndl, ALL);
                          curform := newform ;
                          if (curform == 1)
                          EnaShow(iForm1);
                          ShowBbutton() ;
                          ShowPbutton() ;
                          txt_FontID(hFont1) ; // Font index correct at time of code generation
                          txt_FGcolour(WHITE) ;
                          txt_BGcolour(0x39E7) ;
                          gfx_MoveTo(10 , 16) ;
                          print("MODE:") ;
                          ShowMmessage() ;
                          ShowEtemp() ;
                          ShowRtemp() ;
                          ShowItemp() ;
                          ShowStempForm1() ;
                          else if (curform == 2)
                          EnaShow(iForm2);
                          EnaShow(iWinbutton4) ;
                          EnaShow(iWinbutton5) ;
                          EnaShow(iWinbutton6) ;
                          EnaShow(iStatictext1) ;
                          EnaShow(iStatictext2) ;
                          EnaShow(iStatictext3) ;
                          ShowBbutton() ;
                          ShowPbutton() ;
                          ShowStempForm2() ;
                          endif
                          endfunc

                          Or if, your forms are more 'complicated', you might like to use the fact that all forms and images are in sequence as far as their iName is concerned, eg for the above the programConst.inc file has this in it

                          #CONST
                          iForm1 // offset 0x0
                          iWinbutton1 // offset 0x25A00
                          iWinbutton2 // offset 0x2AC00
                          iWinbutton3 // offset 0x2FE00
                          iWinbutton7 // offset 0x35000
                          iWinbutton8 // offset 0x3A200
                          iForm2 // offset 0x3F400
                          iStatictext1 // offset 0x64E00
                          iStatictext2 // offset 0x66A00
                          iStatictext3 // offset 0x67400
                          iWinbutton4 // offset 0x67C00
                          iWinbutton5 // offset 0x6BA00
                          iWinbutton6 // offset 0x6F800
                          #END

                          You could use a loop to enable and show iForm1 to iWinbutton8 to 'enable' form1 and another from iForm2 to iWinbutton6 to enable form2

                          Comment


                          • #14


                            EnaShow is just

                            func EnaShow(var idx)
                            img_Enable(hndl, idx) ;
                            img_Show(hndl, idx) ;
                            endfunc
                            programConst.inc is built when you click compile, can you find it now?
                            Mark

                            Comment


                            • #15


                              thanks for replying.

                              and yes, i found the file, i just dont have any iform1, iform2... item. I created a program with 4 forms in it, and this is what i get in the file:

                              // File generated 1/25/2013 9:59:45 AM
                              // Warning! This is a generated file, any manual changes will be
                              // lost during the next generation.

                              #DATA
                              byte iKeyboard1keystrokes 0x37, 0x38, 0x39, 0x34, 0x35, 0x36, 0x31, 0x32, 0x33, 0x2A, 0x30, 0x08
                              #END


                              // object indexes into ImageControl
                              #CONST
                              iImage1 // offset 0x0
                              iStatictext1 // offset 0x35C00
                              iLeddigits1 // offset 0x37400
                              iiLeddigits1 // offset 0x45A00
                              iStatictext2 // offset 0x66400
                              iWinbutton1 // offset 0x66A00
                              iLed1 // offset 0x6DA00
                              iLeddigits2 // offset 0x6EE00
                              iiLeddigits2 // offset 0x7D400
                              iStatictext3 // offset 0x9DE00
                              iKeyboard1 // offset 0x9E400
                              iKeyboard1_0 // offset 0xB3E00
                              iKeyboard1_1 // offset 0xB7600
                              iKeyboard1_2 // offset 0xBAE00
                              iKeyboard1_3 // offset 0xBE600
                              iKeyboard1_4 // offset 0xC1E00
                              iKeyboard1_5 // offset 0xC5600
                              iKeyboard1_6 // offset 0xC8E00
                              iKeyboard1_7 // offset 0xCC600
                              iKeyboard1_8 // offset 0xCFE00
                              iKeyboard1_9 // offset 0xD3600
                              iKeyboard1_10 // offset 0xD6E00
                              iKeyboard1_11 // offset 0xDA600
                              iWinbutton2 // offset 0xDDE00
                              #END

                              var disk, hndl ;
                              var oKeyboard1[12] := [-1, 0, 0, 0, 0, 255, 255, 255, 255, 255, 12, 0] ;

                              Comment

                              Working...
                              X