AnsweredAssumed Answered

Cancel window close

Question asked by CraigAlderson on Feb 11, 2014
Latest reply on Feb 13, 2014 by philmodjunk


Cancel window close


     Working with FM 11. I have a window with a list of records. Users can't go into the fields directly to edit them. They must click a button to edit the data in a particular record, and that data is copied to a set of global fields, where it can be edited. To save the changes, users must click a "Save" button. This allows me to test the data to make sure it's complete before copying it back into the record and committing it.

     What I want is to deal with closing the window when edits have been made but the Save button hasn't been clicked. I want a "You have unsaved changes. Continue?" dialog box. The global fields have a variable OKtoExit that is set to false by the field's OnObjectModify event. The window has a Close button that will prompt with the unsaved changes/exit dialog box if OKtoExit is false.

     A few problems: 1) I can't stop the window from closing. If someone chooses "don't close" on the unsaved changes dialog box (i.e., continue editing), the window closes anyway. How can I fix this? 2) I can't cancel the close if someone clicks on the X in the window frame either. I can get the dialog box, but then same problem as in #1. 3) I get the unsaved changes dialog box twice if I click the Close button, but not when I click the X. It's obviously being triggered by the OnLayoutExit event, but I can't figure out why it's being triggered twice.

     Any better way of handling this?