Intercept the Quit

I don’t know anymore :frowning:

My (macos) app has 1 window and cannot be closed.
How can I intercept the action done by Quit in the menubar?

In the CLOSE event?

If your window “can’t be closed”, be sure to check that the close process does not refer to the window or any of its methods or properites, as those will reinstantiate the window again

Yeah in the app.close event, but I cannot cancel the quit or ask if the user really want to quit!

Put a Msgbox in the CANCELCLOSE? if they say “no” then you can cancel…

I never used the CancelClose but that’s prior to the real Close event!

Yes it is Prior to the close event… it detemines if you wish to CANCEL the close (hence the name)

Perhaps, reading the LR might help?

It would if Xojo provided a call tree diagram that outlined the call order of events … :wink: I remember a fogbugz request for this back in the 05/6 timeframe, but I don’t see it in Feedback.

I have been with RB/RS/Xojo since 2000. The answer to that has always been “Do not rely on the order of events. It may change at any time.”

In some cases that is true… but CANCELCLOSE will always occur before CLOSE… since one inititates the other.

Is this a general statement, or just describing what happens in this particular situation.

I find it disappointing that there is not a proper documentation section describing the detail of the Xojo event model, as there is for the HTML DOM.

A quick search of the Forum yields many examples of this statement. I.e. see Norman’s reply in this thread.
https://forum.xojo.com/35030-order-of-events