On Tap! – FileMaker OnGestureTap
You guessed it, this post is all about the OnGestureTap Script Trigger and Get ( TriggerGestureInfo ) Function in FileMaker Pro 13 used in FileMaker Go.
OnGestureTap is a new script trigger introduced in FileMaker Pro 13 which lets you trigger an event with tap controls. It can be triggered with either a Single-tap with one, two or three fingers or a Double-tap with one finger.
To get the most from this you want to use the new function Get ( TriggerGestureInfo ) to get the details of the gesture that activated the trigger. It will return a list of the tap, the tap count, how many fingers were used to make the tap, and the x and y coordinates where the tap occurred.
Here is an example of the list returned:
|tap||1 – Type of gesture.|
|1||2 – Tap count.|
|2||3 – Number of fingers used.|
|300||4 – x Coordinate|
|400||5 – y Coordinate|
The numbers before the description indicate the line in which they are on and you need to know to use the GetValue ( text ) and return what it received on the tap. Below you see how the script and calculation are written to show the arrows in the slide control.
Show / Hide Objects
In the demo file I used a slide control with three panels and hide / show arrows based on a global variable using Hide object when and OnGestureTap. Below shows how I am getting the result using a single tap with two fingers.
Using the GetValue of “3” ( number of fingers ) with a value of 2 and the other GetValue of “2” ( tap Count ) with a value of 1. I didn’t need to get the coordinates in this example.
The Variable being set is used with Hide object when on the Arrows with a value of “null” for them to hide. The only step you don’t currently see is a Refresh Window at the end to update the objects. I could have coded this differently to use refresh object instead and update a Global Variable with the previous panel and the next panel but I’m just using a Go To Object script passing the object as a parameter.[space ]
Show Custom Dialog
For this example, tap the screen one time with 3 fingers. In the script I used the Show Custom Dialog script step but it could be used to create a new record, display a print dialog or anything to speed up a workflow for common tasks.
The script steps below show how to get the value.
Using the GetValue of “3” ( number of fingers ) with a value of 3 and the other GetValue of “2” ( tap count ) with a value of 1. I also didn’t need to get the coordinates in this example.
The Else If is at the beginning since this is all part of the same script, just pulling the parts for the demo.[space ]
Show Custom Dialog Using Tap Coordinates
I have placed a Green Dot below to click on with one finger and one tap.
The Gesture Info values to get the dialog to display are below but using the same script steps from the Panel 2. I added the TriggerGestureInfo to the right of the dot to show the coordinates of the tap which are updated with each tap.
To display the dialog the tap must be in the coordinates: x = 710-730 and y = 400-420
This is used in the Else If portion of the script with the Show Custom Dialog.
And that is how to use the OnGestureTap Trigger and Get ( TriggerGestureInfo ) Function. The workflow enhancements that this can be used for are awesome.
I hope you enjoyed this post. Call us at 877-501-8038 for iOS Development!
Demo File: SCG_TapControl.fmp12
For best results with the Demo File, view on an iPad in landscape mode.
Coordinates panel does not work on an iPhone.