GC GYM Posted February 11, 2007 Posted February 11, 2007 I made a script to run on closing that asks the user to confirm before closing. If they click cancel, I want the file to stay open (I used the 'exit script' step unsuccessfully). If they click cancel it closes anyway. How can I stop it from closing if they click cancel. Phil
IdealData Posted February 11, 2007 Posted February 11, 2007 Here's some help from the FM online help system Get(LastMessageChoice) function Format Get(LastMessageChoice) Parameter None Data type returned number Description Returns a number corresponding to the button clicked in an alert message that is displayed by the Show Custom Dialog script step. Returns: 1 for the first button (by default, labeled OK) 2 for the second button (by default, labeled Cancel)
jamesducker Posted February 11, 2007 Posted February 11, 2007 That's a bit tricky. The close button is very severe. The closest I've come to is this example, which on closing the main file opens a second "reopener" file. The "reopener" prompts the user asking if they want to close or not. If they say no, the "reopener" does what the file name suggests and reopens the main file. In the 'close' script of the main file you'd probably want before closing to "save" certain things (eg current record, current layout) which you could then go back to with an "open" script called by the reopener. This would give the user the impression they hadn't closed at all. close_dialog_example.zip
Stuart Taylor Posted February 11, 2007 Posted February 11, 2007 This is what you are looking for: (Advanced only) best Stuart CloseMe.fp7.zip
GC GYM Posted February 11, 2007 Author Posted February 11, 2007 Thanks ideal. I was using a Get(LastMessageChoice) but that wasn't the part that didn't work. See below James has answered the Q. Many thanks, Phil
GC GYM Posted February 11, 2007 Author Posted February 11, 2007 Thanks Stuart that works even better (in your file) as no second file is needed. I imported the script but didn't know what the custom menu thingy was all about or how it worked. Clearly it's important since the script didn't work in my file without it. No surprises there I suppose. Phil
Stuart Taylor Posted February 11, 2007 Posted February 11, 2007 The file loads the custom menu set on startup The File > Close action has been modified to perform the close script when the Close command is performed.
GC GYM Posted February 12, 2007 Author Posted February 12, 2007 (edited) Thanks Stuart I think I've got it now Phil Edited February 12, 2007 by Guest Read it a few more times
mr_vodka Posted February 13, 2007 Posted February 13, 2007 Just a side note for others, this will not stop the window from closing when the user clicks the 'X' to exit the FM application on the WINDOWS platform though.
Recommended Posts
This topic is 6495 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now