10 Replies Latest reply on Jun 30, 2014 10:51 AM by philmodjunk

    Catching Single Tap or Double Tap -- How?

    gczychi

      Title

      Catching Single Tap or Double Tap -- How?

      Post

           Hi,

           I'm writing my first Go app and I am already stuck a the basics.  Whenever I want to catch a double tap issued by the user I always get a single tap, first. That's awkward.

           I'm using the OnGestureTap/Get(TriggerGestureInfo) combo and want to zoom in with a double tap and zoom out with a single tap through many zoom levels. But I can only toggle between two values, because each time a double tap occurs, a single tap is acted upon, first.

           What can I do? Is there any preferred way to catch a double tap versus a single tap? I think FileMaker is missing some basic functionality, here.

            

           Thanks a lot for any insight!

           Regards,

           Gary

            

        • 1. Re: Catching Single Tap or Double Tap -- How?
          philmodjunk

               I feel your pain.

               I was quite excited to see this new trigger and then became totally frustrated with it when I found that every double tap first trips the single tap--which makes it very difficult to give something both single tap and double tap behaviors. Best I came up with was to set up Install OnTimerScript to start a timer ticking down with a very short time interval from the single tap and used Install OnTimerScript with no parameters in the double tap performed script to cancel the timer. If you tapped once and the timer runs down before you tap again--single tap and the timer performed script does the single tap behavior. If you double tap, you cancel out the timer and do the desired double tap behavior...

          • 2. Re: Catching Single Tap or Double Tap -- How?
            gczychi

                 Hi again,

                 thanks for the hint; I also thought about something like an event handler. Is there any best practice? Would you like to share your code?

                  

                 Thanks!

                 Gary

                  

            • 3. Re: Catching Single Tap or Double Tap -- How?
              philmodjunk

                   In my testing the results were pretty "arthritic" for single taps due to that wait for the timer to run down so I didn't like the results. I think, however, that I used a 1 second interval with the misconception that this was the shortest possible interval.

                   Instead of further tests and experiments, I ended up using an alternative design that didn't require detecting a double tap (opened up a popover with two choices to tap instead.)

                   So it's possible that setting up a timer with an interval of less than 1 second will work well or not at all.

                   Script 1 (run by single tap)

                   Install OnTimerScript [ Script 2 ; .5 seconds ]

                   Script 2 (Run when Timer runs down)

                   Your code for a single tap goes in this script.

                   Script 3 ( run by double tap )

                   InstallOnTimerScript [] ---> empty parameters cancel out the timer
                   Your code for double tap goes here

              • 4. Re: Catching Single Tap or Double Tap -- How?
                TSGal

                     gczychi:

                     Thank you for your posts.

                     Use the function Get (TriggerGestureInfo) if you want to distinguish what type of tap occurred.  The first tap will fire the trigger allowing you to determine that so far there was only one tap, and then the second tap will also fire the trigger, and the function will show there was a second tap.

                     TSGal
                     FileMaker, Inc.

                • 5. Re: Catching Single Tap or Double Tap -- How?
                  philmodjunk

                       @TSGal the problem is not in identifying the type of gesture. The problem is that any double tap gesture first trips the single tap gesture. Thus, it is very difficult to take a single object on the iOS layout and have it perform one script when single tapped and a different script when double tapped. The single tap script runs before you can get the second "tap" in to trigger the double tap.

                       Given the fact that we can't hold down modifier keys while clicking buttons on a touch interface, this makes this promising idea of a new trigger rather disappointing. (Though I've been mentally playing around with a layout filled with a container image and onGestureTap is used to capture the coordinates tapped as a way to set a customizable user interface where the customization may be possible all on the iOS device.

                  • 6. Re: Catching Single Tap or Double Tap -- How?
                    TSGal

                         PhilModJunk:

                         I understand the dilemma.  However, currently the first tap triggers the script, and the second tap triggers the script.  While searching for more information about this behavior, I found your suggestion to our Documentation department asking for clarification.  Although I've also attached this forum thread to the report, I recommend you also enter this suggestion/example into our Feature Requests web form at:

                    http://www.filemaker.com/company/contact/feature_request.html

                         All entries into this web form populate a database that is monitored by Product Management and Development.  All suggestions are discussed and considered for possible implementation in a future release.  Although I could copy your post and the post from "gczychi" and paste it into the web form, there are a couple of contact questions asked that only you can answer.

                         I've also asked for guidance how to execute one script with a single tap and a different script with a double tap (without the first script executing).  When I receive any feedback, I will let you and gczychi know.

                         TSGal
                         FileMaker, Inc.

                    • 7. Re: Catching Single Tap or Double Tap -- How?
                      gczychi

                           TSGal,

                           thanks! I'm really curious what they will come up with.

                           FYI, I have already made a feature request as per your previous link in the other thread, because I believe this is a basic functionality that should be there.

                           Best regards,

                           Gary

                      • 8. Re: Catching Single Tap or Double Tap -- How?
                        TSGal

                             gczychi:

                             This issue is being reviewed.

                             Testing also suggests using the Install OnTimer Script option.  I have a sample file.  Check your Inbox at the top of this page for instructions.

                             TSGal
                             FileMaker, Inc.

                        • 9. Re: Catching Single Tap or Double Tap -- How?
                          sai

                               Phil,

                               How about using a single tap with 2 fingers instead of a double tap with one finger?

                               On a similar topic, I am having a problem with a single tap being processed instead of a button press.  I have a layout with a button used for navigation.  I also have a gesture tap trigger on the same layout to switch from portrait to landscape or landscape to portrait.  When I tap the button, the gesture tap takes over and switches to the layout with the opposite orientation (which is what I want the gesture tap to do).  However, I can no longer trigger the navigation using the button!  Any suggestions?

                               By the way, it would be nice if there was a trigger for changing the device orientation.

                          • 10. Re: Catching Single Tap or Double Tap -- How?
                            philmodjunk

                                 Two fingers makes for a very blunt "pointer" when trying to double tap a typical button. But it may nonetheless be worth trying.

                                 

                                      When I tap the button, the gesture tap takes over

                                 From the help entry for OnGestureTap, it appears that ExitScript [True} might be used to exit the script performed by the gesture and pass the event on to the underlying button.

                                 Since the trigger also returns the coordinates of the gesture, you might also just step up the gesture performed script to perform the button's script when the coordinates returned fall within the location/area occupied by the button.

                                 

                                      By the way, it would be nice if there was a trigger for changing the device orientation.

                                 If you mean a trigger for detecting the fact that your device has changed orientation, the OnLayoutSizeChange trigger in conjunction with the Get ( WIndowContentWidth) as a way to identify the current orientation can be used to switch layouts when the device changes orientation. I've been using this method on my iPhone with great success.