Database Reference
In-Depth Information
OnRecordRevert
When someone reverts a record (using the Records→Revert Record command, or the equi-
valent script step), the
OnRecordRevert
trigger kicks in. The trigger fires before the record is
reverted and works in Browse and Find modes. It's cancelable with a false value in an Exit
Script step.
OnLayoutKeystroke
The
OnLayoutKeystroke
trigger fires every time a key is pressed. Obviously, any script you
trigger should be quick, because it will be called
very
frequently. The trigger fires before the
keystroke is applied and works in Browse, Find, and Preview modes. You can use the
Get(TriggerKeystroke)
and
Get(TriggerModifierKeys)
functions to find out which key
was pressed.
You can also cancel keystrokes. So if you want to stop allowing the letter L in your database,
you could do that by testing for the letter in the field and then canceling the script with a
False result in an Exit Script step. Truthfully, though, keystroke triggers aren't for beginners.
People can press
lots
of different keys. Your script needs to be fast, and it takes a lot of
knowledge to figure out which keys were pressed. For instance, this trigger fires even if
someone presses an arrow key, or the Ctrl or
⌘
key, the Tab key, or a function key. You'll
write a script using keystroke triggers on
Creating a Simple Keystroke Trigger
.
NOTE
One exception is Ctrl or
⌘
key combinations. These
don't
fire keystroke triggers. If you want to
configure keyboard shortcuts to run scripts, then use custom menus (
Custom Menus
)
.
OnLayoutEnter
a Simple Script Trigger
)
. The trigger fires after the layout shows onscreen and works in
Browse, Find, and Preview modes. You can do some initial tab setup, or sort the records, or
even bounce to a different layout if you want.
OnLayoutEnter
is one of the bread-and-butter
triggers for an advanced database that aims to streamline people's workflows.
OnLayoutExit
When you switch away from a layout,
OnLayoutExit
fires. It runs its script before you leave
the layout and works in Browse, Find, and Preview modes. It might seem as if you don't
need this trigger if you've already got
OnLayoutEnter
, but it can make your scripting clean-
er. That is, you can prevent a user from leaving a layout by checking some condition in your