detect manual Window close

For the Mac only, is there a way to determine if the user closed the Window manually by choosing Close or the program used the command Form.Close

In my code i occasionally need to close the current window to show another but optionally want that when the user chooses to manually press Cmd-Q or the Red button to have the app.autoquit instead

In the app.open event of your program put

auto quit = True

If the window closed by the user is the only window open, your app will automatically quit.

Look at the Window.Close and Window.CancelClose (who is fired under cmd-q, click in window close button, cmd-w.