Force app to QUIT

I want my app to quit in certain circumstances in event
by using the QUIT command, I also set app.autoquit=true before I want to quit the app,
but it happely continues processing.
Any idea why it does not quit ?

Try moving the commands to the ACTIVATE event instead

app.autoquit only comes into play when there is one or more windows in the process of closing (ie. quit app when all windows have been closed)

Quit should terminate the app immediately, unless you return True in the CanceClose event.

Are you sure your conditions are right ? Try placing system.debuglog "really quit" just before quit, run the app and look in the message (right hand side icon at the bottom of the IDE central pane).

I have never (rarely) had QUIT work during APP.OPEN

Seems to work fine at least in the IDE …

try ExitMBS if you use MBS Plugins.

Make sure you don’t trap for Exceptions at the bottom of your Quit Event, in case it is stopping the quit from finishing here.

Set the default window to None. Otherwise, the window will continue opening even if you Quit. Test your conditions and either Quit or Show the appropriate window. Never had it fail.

default window “none” is working, but I needed additional code to make it work for me.
I needed a variable to skip the code in the app.close event (see example below), and that works fine.

if NOT ConnectToDatabase() then 
  // boolean must be before QUIT command
  // because QUIT goes straight into app.close event 
  bQuitting = True

end if

There’s a couple of declares, which I don’t have to hand (not at home) will kill the application. you can find one of them in the App Store receipt validation function. the other is the terminate function of the NSApplication.

I just solved an similar problem:

My application should be terminated, when a certain condition was true.
I added App.AutoQuit = True in the App-open-event.
I closed every window of the application (though some of them were never opened)
I set an additional self.close in the line before there was the Quit-Statement.

But the Application continued to work.

Then I put on the end of the routine:

Goto Weiter



and an appropriate condition, where I checked the circumstances:

if dbitem2 = Nil then Goto Endlauf end if

And after that it worked.

So I reccon, that there is no way to stop an already running routine. You have to got to the end of the routine and there the quit works.

The additional: Goto Weiter is there, to avoid that the programm runss into the quit, when eberything is ok.

Use exit instead of Goto.

You must have missed one. Did you do this by iterating through the Window() array?

You are mistaken.