In an FMP/A environment that allows for plugins, you can use a technique described at the following post:
Essentially the idea is this:
1) Define a custom MenuSet that you apply to all windows that need this "On Activate" trigger feature.
2) In the custom MenuSet, override one of the menus such that the Menu title is determined via calculation.
3) In the calculation to return the Menu title, you can return the standard title for the menu, but somewhere in the body of the calculation, send a command (via plugin) to trigger an FMP script. This script will act as your "On Window Activate" trigger.
How It Works:
When a different window is revealed/selected during the course of user action, the MenuBar will re-evaluate the function that returns the menu title. This is the hook that triggers your calculation, which in turn, triggers your handler script.
1) You should not need to create multiple MenuSets to make this happen. The same modified MenuSet can be used across as many windows as you choose.
2) There are at least a few free plugins that should offer you the ability to trigger a script from the calculation engine. I believe that any one of them should work fine. I have not tried this on a Windows system, but IIRC, the OP of the post mentioned above had success with this on both OS X and Windows.
3) I can't recall whether or not I re-tested this function when v.14 was released. It's possible that I did not. I hope it still works!
Very kind regards & HTH,
Thank you very much. Though in this case needed the trigger for an iOS situation, I may well apply it to desktop problems, clever!
Perhaps the existence of this workaround means that I'm not just missing this as a native FileMaker ability?
If there is a more direct/native means of doing this, then I'm missing it, too.
Sorry that it doesn't work for iOS. If I come across some other clever workaround suitable for iOS, I'll post back...
Steve, and anyone else interested in getting this feature, I've added a New Feature Request.
Please do the same to chime in? Here is what I wrote:
(The link for Feature Request:)
OnWindowActivate script trigger (and OnWindowDeactivate)
It would be very useful to be able to fire a script when a window becomes the active window, either by it being clicked on (or selected in the iOS Window chooser) or being uncovered by another being closed, or if being activated by script. This could be used, for example, to trigger object or entire window refreshes. Similarly, the corresponding Deactivate script could be used to Commit a record when the window is hidden, moved to the dock (minimized), or loses focus because a new window is active. I would use this to help prevent "can't modify because record open in other window" errors.
Troy - I have used tons of time trying to resolve the lack of window coordination without triggers to detect window activation. Really happy to see your posting. I was unable to find it though in the New Feature Request area. I want to vote for it!