Announcement

Collapse
No announcement yet.

UserButton not detected

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

  • UserButton not detected

    Hello,

    I am having issues with the detection of some UserButtons.

    My program is composed of several Forms, and on most of them, all is fine.

    On two of them however, the img_Touched(hndl,-1) will never return the the UserButtons I am touching.
    For one of them, none of the buttons are detected.
    For the other, only 6 out of 8 buttons are detected.

    I have to check the X and Y coordinates to detect the button being pressed, which is not ideal (need to update the code when I move the button to re-arrange UI)

    I know that :
    - There is no "broken" part in the display, since in other Forms, I can detect some touches in the same area
    - The touched is enabled

  • #2
    Hi Vincent,

    This can happen if a widget on a previous form is still touch enabledI. If this is the case the value of img_Touched won't return the correct value.

    img_SetAttributes(hndl, iWinbutton1, I_TOUCH_DISABLE);

    You could disable touch on all objects when changing form and just enable touch on the newly displayed objects.

    I hope this helps

    Best regards

    Paul

    Comment


    • #3
      Hi Paul,

      Thanks for you feedback. I will look into that.

      Is there any "shortcut" to disable all widgets of a form in a single instruction, or should I disable all the widget individually ?
      At the moment, I disable all widgets before leaving a for, and enable only the ones that I need in the other form. But there is always a change to forget one.

      Comment


      • #4
        Hi Vincent,

        You could use a for - next loop to disable all widgets but you will have to count how many there are.

        var numberOfWidgets;
        var n;

        numberOfWidgets := 20;

        for(n := 0; n < numberOfWidgets; n++)
        img_SetAttributes(hndl, n, I_TOUCH_DISABLE);
        next

        Best regards

        Paul

        Comment


        • #5
          I check all the widgets, and seems that I am not missing any : all the "previous" get touch disabled.

          I also changed my code code, so that the program starts on the faulty from : no luck, problem is still there.

          I am a bit confused on what to do. I know that working with coordinates is working, but I also know that it is not normal, and that there is probably something wrong somewhere...

          Comment


          • #6
            Hi Vincent,

            You will have to also disable touch on non-touch widgets eg if you have a button on top of an image then the image will also need to have touch disabled. If the issue is still there, would you like to send me the code just for the setting up of the form with the two faulty buttons.

            Best regards

            Paul

            Comment


            • #7
              Looks like I found the issue !

              When I use img_SetAttributes(hndl, iForm6, I_TOUCH_DISABLE); , I can get my buttons on Form8 to work.

              However, this is rather strange because the iForm6 I do not call the img_ClearAttributes(hndl, iForm6, I_TOUCH_DISABLE); before.
              Appears that the attribute is set by default for a From.

              Comment


              • #8
                Hi Vincent,

                Yes that is correct as the form then has the same properties as an image widget. You could still use the for - next loop approach and that will disable touch on all widgets including images and forms.

                Best regards

                Paul

                Comment


                • #9
                  Hi Vincent,

                  You can use this command to disable touch on all widgets.

                  img_SetAttributes(hndl, ALL, I_TOUCH_DISABLE);

                  Best regards

                  Paul

                  Comment


                  • #10
                    Originally posted by pauleilio View Post
                    Hi Vincent,

                    You can use this command to disable touch on all widgets.

                    img_SetAttributes(hndl, ALL, I_TOUCH_DISABLE);

                    Best regards

                    Paul
                    Thanks for that ! This is the best for me.

                    Anytime I change Form, I will just use this function.
                    Like so, I am sure that there is no widget touch-enabled, and then only init the widgets I need.

                    Comment

                    Working...
                    X