Database Reference
In-Depth Information
can write a script to close them all whenever you close the main file. To set up file option
triggers, choose File→File Options and then click the Script Triggers panel ( Figure 11-21 ) .
OnFirstWindowOpen
Just as it sounds, OnFirstWindowOpen runs when you open your database and its first win-
dow is opened. This script trigger is very useful because it can run a setup script that finds
and shows you specific data when you start work. But if a script from another database or a
relationship opens your database, your database's first window may be hidden ( Bringing a
Window to the Front ) . In that case, the OnFirstWindowOpen script trigger won't run. When
it does run, OnFirstWindowOpen is triggered before FileMaker enters a mode. That's import-
ant because layout triggers can be set to run in specific modes. So if your database's first
window opens to a layout that has a layout trigger set, the OnFirstWindowOpen script will
run and then the layout trigger script will run.
Figure 11-21. The OnFirstWindowOpen script trigger is set to run the Find Unpaid Invoices script
when the database is opened. The “first” in the script trigger's name is important. The script won't
run every time you open a new window for your database or if you manually hide all its windows
and then show them again (Window→Show Window→[Your Window Name]).
OnLastWindowClose
As you're working on your database, you'll often open several windows. The OnLastWin-
dowClose script trigger fires just before the last window of your database is closed. In other
Search WWH ::




Custom Search