FileMaker OnObjectKeystroke Script Trigger Explored

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

The OnObjectKeystroke script trigger is quickly becoming one of the favorite choices of FileMaker developers wanting to strut their FileMaker geek kung fu. This in turn is starting an avalanche of really compelling user interface design techniques that are taking the FileMaker community by storm.

What the OnObjectKeystroke script trigger allows the developer to do is, perform a script when keyboard or Input Method Editor (IME) input is detected within a layout object (most likely a field). The OnObjectKeystroke trigger can be fired within any layout object that can accept Keyboard Focus. The primary target of the OnObjectKeystroke will be fields but they can be assigned to buttons, tab panels, portals and web viewers. Although the OnObjectKeystroke can be applied to a portal or web viewer object, you are not going to be able to get the OnObjectKeystroke script trigger to fire.

We should also mention there is a layout based cousin to the OnObjectKeystroke trigger called OnLayoutKeystroke.

There are so many great techniques flying around these days, it is hard to pin down who the credit for which one of them should go to. I will say the first implementation I had seen that had me sit up in my seat was by John Mark Osborne in the online FileMaker training library by VTC.com (http://www.vtc.com/products/FileMaker-Pro-10-Advanced-Tutorials.htm). This is a technique that allows you to have a field that returns a found set of records as you type. It is in the Event Driven Scripting section of the Advanced tutorial series.

PLAN YOUR TRIGGER AND TRIGGER YOUR PLAN
Now we should also mention that keyboard triggers are nothing new to computer users in general. The operating system of your computer, applications and other processes have been using them all the time. So your keyboard combination to fire a trigger might be the same as one used by your operating system, another system resource or FileMaker itself and all of these may have priority over your OnObjectKeystroke settings. So be sure to test your trigger implementations diligently.

INTERESTING LEFTOVERS
The OnObjectKeystroke trigger is what is called a Pre-Event Script Trigger. Pre-Event triggers have an important advantage over Post-Event triggers in that they can have a cancel action available to the developer within them.

When used properly, the calculation engine function Get (TriggerKeystroke) function can capture what keyboard entry was used to fire an associated OnObjectKeystroke script trigger.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2009 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.