Reference > Script triggers reference > OnObjectKeystroke
 

OnObjectKeystroke

Performs a script when an object is active and receives one or more characters from the keyboard, either directly or via an input method editor (IME). Use the Get(TriggerKeystroke) function to return the characters that activated the script trigger.

When the script runs

Before the event has been processed.

Modes in which the trigger can be used

Browse and Find modes.

Result

You can use the Exit Script script step within the triggered script to return True or False.

True: The event that triggered the script proceeds.

False: The event that triggered the script is canceled.

Compatibility 

 

Product 

Supported 

FileMaker Pro Advanced 

Yes 

FileMaker Go 

Yes 

FileMaker WebDirect 

No 

FileMaker Server 

No 

FileMaker Cloud 

No 

FileMaker Data API 

No 

Custom Web Publishing 

No 

Runtime solution 

Yes 

Originated in 

FileMaker Pro 10.0

Notes 

Combining keystrokes in an IME will not activate this script trigger. Instead, the trigger activates after the text is committed in the IME. The triggered script processes the committed string.

Use the Get(TriggerModifierKeys), Code, and Char functions to work with special characters such as navigational keys like the Tab and the arrow keys, and with general Unicode characters. See the Code function for a list of navigational keys and the codes reported to a script. The Char function returns the characters for Unicode code points.

Keystrokes are processed in the following order:

1. The operating system processes certain keys.

2. FileMaker Pro Advanced processes keyboard shortcut keys.

3. A script triggered by the OnObjectKeystroke script trigger processes the characters.

4. A script triggered by the OnLayoutKeystroke script trigger processes the characters.

5. Navigational keys are used for navigation, while non-navigational keys are processed by the active object if there is one.

6. If there is no active object, an alert displays for non-navigational keys.

The first of these steps to use the key stops the process. A script executed by the OnObjectKeystroke or OnLayoutKeystroke script trigger can stop further processing of the keystroke by returning False.

Keyboard shortcuts, such as cut and paste actions (Ctrl+X, Ctrl+V in Windows, Command-X, Command-V in macOS), will not activate this script trigger.

Using the arrow keys or mouse to navigate and select within pop-up lists, menus, and calendars will not activate this script trigger. Entering text into these fields will activate this script trigger.

The OnObjectKeystroke and OnLayoutKeystroke script triggers do not activate if the active object is a web viewer.

The OnObjectEnter script trigger, OnObjectExit script trigger, and OnObjectKeystroke script trigger can be activated when assigned to summary and calculation fields.

See Actions that don’t activate script triggers for a list of actions that do not activate this script trigger.

Related topics 

Setting up script triggers

Setting script triggers for layouts

Setting script triggers for objects