Jump to content
Server Maintenance This Week. ×

Prevent accidental exit (FM10 only)


This topic is 5543 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 by Guest
Link to comment
Share on other sites

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 ).

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.