does anybody know whether you can tell in a close script whether the file is closed by Quoting the Application or by closing the window?
Thanks in advance and best regards - Dick
Your app is a file that's opened within a "wrapper" parent application, so there's a limited amount you can achieve interacting with the "wrapper" from inside the file itself.
FileMaker makes available an OnLastWindowClose script trigger, as well as the Close File and Exit Application script steps. The trigger will run regardless of if the program is closed, or the file's only window is closed. So while it can't be used to detect the method of closing, it can be used to block the closing of a window unless you conditionally validate it.
EG, a simple OnLastWindowClose trigger script:
If [ not $$allowClose ] Show Custom Dialog [ ERROR ; You are not allowed to close the file, please use the exit button ] Exit Script [ False ]End If
If [ not $$allowClose ]
Show Custom Dialog [ ERROR ; You are not allowed to close the file, please use the exit button ]
Exit Script [ False ]
Coupled with an "Exit" button:
Set Variable [ $$allowClose ; true ]Close File # OR - Exit Application
Set Variable [ $$allowClose ; true ]
# OR - Exit Application
With custom menus installed as well, you can override the menu commands with your own.
A few other times this was discussed:
OnLastWindowClose, Quitting or closing?
On Last Window Close
thanks for your ideas. Unfortunately, I'm not looking for a separate Exit button but want to be able to tell whether the window is being closed by the user closing the window or by the user Quiting FileMaker ...
You may have missed my note about custom menus. I'd check that out and see if it works for your use case.
Custom Menus Exit Option
thank again, but (as far as I know) there's no custom menu for 'Quit FileMaker Pro' ...
Per jbante on the thread I linked to above:
You could replace any entire pull-down menu except the "Tools" menu in FileMaker Pro Advanced and the application menu (named the same as the running application) on Mac — which contains the Mac equivalent of the "Exit" option.
nice idea, but this will not work as you're not allowed to use the Command-Q shortcut in a custom menu item ...
Retrieving data ...