No announcement yet.

img_Touched(hndl, -1) Only Returns 0

  • Filter
  • Time
  • Show
Clear All
new posts

  • img_Touched(hndl, -1) Only Returns 0


    I am a new user of the 4D Systems products. I am working with the Gen4-uLCD-24PT.

    I am simply trying to get a button press input for my code. The problem seems to be that when I call img_Touched() function, I am returned "0" no matter what. I am currently implementing it as follows:

    var imageTouched;

    imageTouched := img_Touched(hndl,-1); //Check to see if buttons have been pressed:

    if(imageTouched==iWinbutton1) //if "continue" is pressed...

    I've been referencing sample code and those seem to run fine. But in my code, img_Touched(hndl, -1) == 0 no matter what.

    What is going on?


  • #2
    Good day joshauri,

    Welcome to the forum.

    Can you send me the whole code so I can simulate it here on my end?

    To help you in understand the touch functions and capabilities of the display modules, please read and download
    the sample programs in these links:

    Designer or ViSi Touch Detection

    ViSi Winbuttons

    Best Regards,


    • #3
      Ok, thanks for these resources; with them I was able to troubleshoot and solve the problem.

      I discovered that an image that I was using as a "splash screen" was triggering the img_Touched() function. Since the splash screen image was my first image element, img_Touched(hndl,-1) returned 0. I was able to resolve this issue by simply "disabling" the splash screen image when I moved on to the next form.

      The thing I don't understand is why the splash screen image was continuously triggering a touch event, even when the screen wasn't being touched. I am not even sure why the image was even being considered a touchable element since it isn't a button or anything. But disabling it did the trick!



      • #4
        Hey joshauri, I know this is an old thread but could you tell me how you disabled the splash sceen? Did you use
         img_SetAttributes(....., I_TOUCH_DISABLE)

        Edit: Nevermind, that was it and it worked for me too