Announcement

Collapse
No announcement yet.

Button activation on "Double touch" ?

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

  • Button activation on "Double touch" ?

    Just finished my project with Visi Genie and i was wondering if there is any way to activate a form-event after double touching a button or screen area.
    This can be helpful in order to avoid accidental trigger of an event.

    Any ideas?

  • #2
    Dear Sorin,

    I may suggest that you use a counter everytime a report event is triggered from the button or any other widget.
    With this, use a modulus operator (%) with an integer 2 which whenever goes 0 or 1 would perform a specific routine.
    Thus, this creates a double touch response.

    I hope the above helps.
    And should you need further assistance, please do not hesitate to contact us anytime.

    Best Regards,
    Danica

    Comment


    • #3
      Hi Danica,
      Thanks for reply.
      A short example will be very nice, if possible...since i`m not a programmer i`m struggling a lot to understand this things...

      Regards
      Sorin

      Comment


      • #4
        Dear Sorin,

        Assuming you're using genie library, you may use the condition:

        Code:
        if (genie.EventIs(&Event, GENIE_REPORT_OBJ, GENIE_OBJ_WINBUTTON, 0))
          {
            counter++;
            if (counter % 2 == 0)
            {
              genie.WriteObject(GENIE_OBJ_USER_LED, 0, 1);
            }
            else
            {
              genie.WriteObject(GENIE_OBJ_USER_LED, 0, 0);
            }
          }
        Otherwise, you may download the genie library in the link below:
        https://github.com/4dsystems/ViSi-Genie-Arduino-Library

        Also, you can add the millis function in setting time between the clicks to further recognize that a double tap has been made.

        I hope the above is useful to you.
        Please feel free to contact us if you need any further assistance.

        Best Regards,
        Last edited by Danica; 21st December 2018, 04:34 PM.
        Danica

        Comment


        • #5
          Thanks for the code, but it was not exactly what i wanted since i`m not using genie library.
          I followed your suggestions and come up with this one that it`s working:

          var counter ;
          if (ImageTouched == iUserbutton0)
          (counter++ !=1) ;
          pause(100) ;
          if (counter % 2 == 0)
          ActivateForm(1)
          endif
          endif



          Regards
          Sorin

          Comment


          • #6
            Hello Sorin,

            Glad to know that the counter worked for your program.
            On the other hand, the
            Code:
            (counter++!=1)
            can be replaced by
            Code:
            counter++;
            wherein every time the user button is touched, the counter adds up by 1.
            Also, you may include an additional condition as
            Code:
            if (counter % 2 == 0 && counter != 0)
            I hope the above helps.
            If you require any further information, please let us know.

            Best Regards,
            Last edited by Danica; 26th December 2018, 09:20 AM.
            Danica

            Comment

            Working...
            X