Dave Graham Posted January 19, 2009 Posted January 19, 2009 (edited) 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, 2009 by Guest
mr_vodka Posted January 19, 2009 Posted January 19, 2009 Good to know. I haven't come across this yet as I have used a custom menu for exiting the application.
Raybaudi Posted January 19, 2009 Posted January 19, 2009 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 ).
Vaughan Posted January 20, 2009 Posted January 20, 2009 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
Raybaudi Posted January 20, 2009 Posted January 20, 2009 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.
comment Posted January 20, 2009 Posted January 20, 2009 I don't want to spoil it for you - I am sure you can figure this out. : http://www.screencast.com/t/XHw9WDyXB
Raybaudi Posted January 20, 2009 Posted January 20, 2009 Yes, your ControlledClose10.fp7 do exactly what I am NOT ( still ) able to do. Searching... :
Gilbert Posted February 5, 2009 Posted February 5, 2009 (edited) :sorrysign: Edited February 5, 2009 by Guest
ML2008 Posted February 22, 2009 Posted February 22, 2009 Hi, where is the ControlledClose10.fp7? Can you send me the download link!
Recommended Posts