1/27/14: Check out the updated version of this post (updated for FileMaker 13).
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
- 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.
Update: I updated the graphic because the original one had the
OnWindowOpen triggers backwards, with respect to the pre/post-event firing. Same goes for the