Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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)

Posted

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

Posted

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

Posted

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

Posted (edited)

Thanks Stuart I think I've got it now

Phil

Edited by Guest
Read it a few more times
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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