A Nice Little FileMaker Pro Tip-n-Trick Showing You a Double-Single Click Trick!
Have you ever wanted to add support for double-clicking in your FileMaker Pro solutions? FileMaker Pro doesn’t currently support that natively, but various workarounds have been created over the years. Unfortunately, none of the techniques I found supports exclusive actions. BOTH the single and double-click actions occur when the user double-clicks. This FileMaker Pro double-single click trick file offers a simple alternative that enables your solutions to perform only one OR the other.
This technique and the FileMaker set-up download have been tested and work with FileMaker Pro versions 12 and 13.
Go here to download the “how-to” file.
Although untested, this technique is likely to work in any version of FileMaker Pro that supports both the Get(ScriptName) function and fractional seconds in the Pause Script duration.
Click away and enjoy the double-single click FileMaker tutorial!
– Andy
If you prefer video tutorials, check out this video that takes you through Andy’s technique step-by-step.
*This article is provided for free and as-is, use and play at your own risk – but have fun! Excelisys does not provide free support or assistance with any of the above. If you would like help or assistance, please consider retaining Excelisys’ FileMaker Pro consulting & development services.
About Excelisys, Inc.: Founded in 2001, Excelisys (www.excelisys.com) is an FBA Platinum Partner and FileMaker Certified developer organization. Excelisys specializes in designing, developing, customizing, supporting, consulting, migrating, upgrading, fixing, and integrating of FileMaker Pro and FileMaker Go database solutions, MySQL, PHP, CodeIgniter, PostgreSQL, QuickBooks-FileMaker Pro Integration, Excel and MS Access to FileMaker Pro conversions/migrations, iPhone and iPad business solutions, and other various database frameworks and web technologies that automate your organization’s data solution needs for use on the web, mobile, and desktop platforms. Contact Excelisys today for a free estimate and consultation about your business software automation needs @ 866-592-9235.
Unfortunately it does not work on script trigger, entering object: the parameter get(Scriptname) is not passed
You are correct that this approach will not work with the onObjectEnter script trigger. The crux of the problem is that FileMaker only triggers the event the first time you click in the field because the focus is already in the field when the second click occurs.
You can confirm this behavior in the sample file by adding a field, creating a record, and assigning the trigger to the Double Click script. After clicking in the field and dismissing the dialog, you can then see the cursor in the field and click again with no subsequent dialogs until you exit the field and click into it once more.
Hi Excelisys team, thank you for your amazing tips, it really helps.
I think this technic is very simple, no script parameters, no more extra lines.
#Double Click
Set Local Variable [$Click_CurrentTimestamp ; Get ( CurrentTimeUTCMilliseconds ) – $$Click_Last_Click_TimeStamp
Set Local Variable [$$Click_Last_Click_TimeStamp ; Get ( CurrentTimeUTCMilliseconds )
If [ $Click_CurrentTimestamp < 300 ]
Show Custom Dialog [ "Yes, it was a double click." ]
End If
That's it.
You’re welcome! And thanks for the suggested enhancement. Some of our tips highlight features of FileMaker that might be underutilized, such as using the Get(ScriptName) function to identify a running script when clicking a button. FileMaker is certainly a flexible platform and in this case allows at least a few ways to achieve the same effect.
Here’s yet another approach using only the If() statement to make the decision. Because of the order of operations, the variable will be set after the time interval has been evaluated.
If [ ( Get ( CurrentTimeUTCMilliseconds ) – $$Click_Last_Click_TimeStamp < 300 ) or Let ( $$Click_Last_Click_TimeStamp = Get ( CurrentTimeUTCMilliseconds ) ; False ) ]
Show Custom Dialog [ “Yes, it was a double click.” ]
End If
Hi! I’m trying to this and It doesn’t work? Why? Thanx in advance.
If [ ( Get ( CurrentTimeUTCMilliseconds ) – $$Click_Last_Click_TimeStamp < 300 ) or Let ( $$Click_Last_Click_TimeStamp = Get ( CurrentTimeUTCMilliseconds ) ; False ) ]
Show Custom Dialog [ “Yes, it was a double click.” ]
Exit Script
End If
Go to another layout, etc. (do another thing)
Can I capture only one click in the same script to do something different than double click?
The problem with actions on both a single click and a double click is that everything starts with a single click. You would never make it to the double click without waiting a bit after the single click occurs. That’s the purpose of the pause step in line 12 of the tip file script.
So if you want to support both actions, you have to go back to the original approach shown in the tip file.
My Problem with this script was that I needed to use it in a Selected ROW of related records (in the body section of a layout)…. This script will not identify if 2 different rows were clicked within the pause interval… which created a problem.
I modified it to pass Record ID parameters instead of ScriptName and compare this parameter to a Previous record selected variable.
then when action was taken depending on match , I cleared the current record variable to start over.
I’m not an experienced developer in Filemaker, Im sure this could be simplified, but here is a copy of my working code.
———– Script ——————————————————-
Set Variable [$doubleclick_interval; Value:.3]
#if the currently running script is the same as this one, it’s a double-click
If [(Get ( ScriptParameter ) = $$Selected_Record)]
Set Variable [$$Selected_Record; Value:0]
Show Custom Dialog [Title:”Action”; Message: “Double click!”; Default Button:“OK”, Commit:“Yes”]
#stop the other instance of this script
Halt Script
Else
Set Variable [$$Previous_Record; Value:$$Selected_Record]
Set Variable [$$Selected_Record; Value:Customers::CUSTOMER ID MATCH FIELD]
#Otherwise, it’s a the first click. Wait for the double-click duration to see if the user will click a second time.
Pause/Resume Script [Duration (seconds):$doubleclick_interval]
#if not, it’s a single click
Set Variable [$$Selected_Record; Value:0]
Show Custom Dialog [Title:”Action”; Message: “Single click!”; Default Button:“OK”, Commit:“Yes”]
Halt Script
End If
—————————————————————————
****PARAMETER PASSED IN BUTTON PRESS*******
Customers::CUSTOMER ID MATCH FIELD
****NOTE: “Customers::CUSTOMER ID MATCH FIELD” is the Customer ID field that identifies each record in table Customers
Did you also try reducing the pause interval? That ‘0.3’ seconds was a relatively arbitrary number that can be adjusted to some degree.