January 19, 200916 yr The new FM 10 events are getting a lot of press, but there's one event that we've always had that just got a tiny bit more powerful. The OnLastWindowClose event is the event which has always triggered the script you've selected to run when closing the file. In FM 10, this event has now been modified to run the script prior to the event, which means that you can now ask the user if they really want to quit the database. If you return an Exit Script [result=false] step then it wont execute the close command on the last window for that file. Edited June 7, 200916 yr by Guest
January 19, 200916 yr Good to know. I haven't come across this yet as I have used a custom menu for exiting the application.
January 19, 200916 yr Hi David Ok, this is interesting but is it praticable ? Let say that I have this script to run when closing the file to prevent accidental closing with the windows's X : Show Custom Dialog [ "You can't close this file in this way" with OK ] Exit Script [ Result: 0 ] End If How can I modify that script to allow the user to close the file ONLY with a button on the layout ? This, for example assigning 1 to the script parameter of the button, do not work: If [ Get ( ScriptParameter ) ] Close File Else Show Custom Dialog [ "You can't close this file in this way" with OK ] Exit Script [ Result: 0 ] End If The problem is that I can't write anymore the script step "Close File", otherwise the script will fire another time ( and w/o the script parameter ).
January 20, 200916 yr AFAIK, all you have to do is return a true exit script and the triggering event (close last window) will continue. If [ Get ( ScriptParameter ) ] Exit Script [ Result: 1 ] Else Show Custom Dialog [ "You can't close this file in this way" with OK ] Exit Script [ Result: 0 ] End If
January 20, 200916 yr AFAIK, all you have to do is return a true exit script and the triggering event (close last window) will continue. But where is the "Close File" step ? We aren't closing with the close command, but with a button on the layout that fires this script.
January 20, 200916 yr I don't want to spoil it for you - I am sure you can figure this out. : http://www.screencast.com/t/XHw9WDyXB
January 20, 200916 yr Yes, your ControlledClose10.fp7 do exactly what I am NOT ( still ) able to do. Searching... :
Create an account or sign in to comment