MenuItem Quit and CancelClose with Return True

On my main window for the Quit MenuItem I have this code

Self.Close
Quit

I also have some supporting windows which I give the user the option of stopping the quit process (CancelClose) with a dialog, which return true in this case.

Ever since I got it so the supporting windows, this dialog show up twice. First time the cancelClose is ran is from Self.Close, and the second is from Quit.

I have tried removing Self.Close, but Quit won’t fire if more than 1 window is open.

Is there any way I can get everything I want, Supporting Windows stopping close and the dialog only showing up once?

Quit should be enough. It calls App.CancelClose and if that doesn’t return True, it calls CancelClose on all open windows. If the window doesn’t return true, it closes it and moves on to the next one. If any window’s CancelClose returns True, it stops right there. You must have some code that is interfering with the process.

http://docs.xojo.com/Quit

Thanks. I hadn’t put enough break points in and didn’t think it would start first with the App’s CancelClose. I found a problem there. Tomorrow.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.