In my main window, I use the CancelClose event to allow the user to save unsaved data when closing the window (either via the Quit menu or by closing the window). I then call Quit in the Close event. However, I’m seeing the CancelClose event being called again when Quit is called. The result is that my App doesn’t quit when the window’s Close button is clicked. I’ve even added a check for appQuitting at the top of the CancelClose event …
Don’t call Quit in the Close event. It’s creating another attempt to close the window and it hasn’t finished closing during the Close event. That’s where the second CancelClose event is coming from. App.AutoQuit = true is the correct way to have your app quit when the last window is closed.
Just because it ‘worked’ doesn’t mean it was supposed to. It might have changed because a bug was fixed that altered behavior a bit.
If closing your main window quits the app then I would check for the AppQuitting parameter to see if it’s true. If it’s true you know it came from the app trying to quit and you can see if you’ve saved changes (returning true keeps it from quitting). If it’s false it’s your window attempting to close and you can call Quit. It’s up to you managing it via the AppQuitting parameter.
I think it’s a tricky way of doing it but I feel it’s possible.
Heads up, 18r4 has some internal changes on Windows in regard to the Window() function. Collect them into an array, then iterate through the array to close them.