© 2010 Dwayne Wright - dwaynewright.com
I did some experiments with the OnObjectEnter trigger today and thought I’d share my results. I was wondering what conditions could prompt the OnObjectEnter script trigger to fire automatically. When FileMaker goes into browse mode, it doesn’t enter into a field or object automatically. So the OnObjectEnter trigger isn’t that much of an issue. However this is not necessarily the case when going into find mode.
When FileMaker goes into find mode, it can enter into a layout object automatically. There is a condition branch based upon if the user was in a field as they entered into find mode or not. If you are in a field in browse mode, find mode will automatically place you into that same field as you go into find mode.
FYI... The exception is that if you don’t have the field setup to be entered into in Find mode. FileMaker is smart enough to see this setting and respect it. To the right you can see the new FileMaker 11 inspector and it is currently set to not allow find mode to enter into a selected field.
So now lets say that we have a field capable to be entered into and has the OnObjectEnter script trigger setup to fire in find mode. There are some interesting behaviors that may come into play.
As I mentioned, if you are in a field in browse mode, you will be placed into that same field in find mode. This will cause the attached OnObjectEnter script trigger to fire. If you are not in a field when going into find mode, FileMaker will place you into the first field in the tab order. If that field has an OnObjectEnter trigger attached and configured for find mode, it will fire automatically.
This is something to be aware of because you could have a script fire automatically for users in Find mode by doing something as simple as modifying the tab order or copying that field from another layout.