There are quite a few nuances in how FileMaker script triggers function. Two of the more straightforward ones are the sequence that script triggers evaluate in (e.g. OnObjectKeystroke fires before OnLayoutKeystroke) and the timing of a script as compared to the event that triggered it (i.e. pre- vs post-event triggering).
For me, the difficulty with these two attributes isn't comprehension; it's memorization. I find myself looking this stuff up over and over again. So, to make it easier to remember, I mocked up the following diagram. Hopefully it has some use for you as well.
Breaking this graphic down a bit...
There is a method to the order in which triggers fire:
- First there is the entering into the interface elements, which happens in the following order: window, layout, mode, view, record, object.
- Next is the interacting with the objects that have been laid out; e.g. a user types something, a script changes some data, etc. Each of these script triggers deals with objects (except for the OnLayoutKeystroke).
- The "transaction" is completed with the leaving of the interface elements, which happens in reverse order: object, record, view, mode, layout, window.
I've marked the post-event actions in red to connote a sort of warning, since FileMaker does not allow us to cancel these triggering events.
Soliant Consulting employs the largest FileMaker development team in the world. We have a deep bench of talent starting with our CEO, Bob Bowers: he's co-authored seven books, led the team that has written six editions of the Authorized Training Series for FileMaker, Inc., spoken at more than a dozen FileMaker Developer Conferences, and has taught literally thousands of students spanning two decades of leadership in the field. Certified Expertise Soliant's team is certified in every version of FileMaker Pro and are specialists in building high-performance databases, hybrid web-FileMaker applications, integrations with a range of technologies including SQL, and conversions from prior versions. We work with your solution as is or can build from scratch. Find out how we can take your FileMaker databases to the next level.Website: www.soliantconsulting.com/filemaker