Difference between revisions of "Quit"

From Xojo Documentation

Line 26: Line 26:
  
 
==Notes==
 
==Notes==
Calling the '''Quit''' method will call the [[Application]] class’s [[Application.CancelClose|CancelClose]] event. To cancel the close, return [[True]] from this event. If it does not return [[True]], each window's [[Window.CancelClose|CancelClose]] event handler will execute. CancelClose and Close are called as a pair for each open window.
+
Calling the '''Quit''' method will call the [[Application]] class’s [[Application.CancelClosing|CancelClosing]] event. To cancel the close, return [[True]] from this event. If it does not return [[True]], each window's [[Window.CancelClosing|CancelClosing]] event handler will execute. CancelClose and Close are called as a pair for each open window.
  
If a [[Window.CancelClose|CancelClose]] event handler returns [[False]] (the default action) then the window's [[Window.Close|Close]] event handler will be executed. If any window's CancelClose event handler returns [[True]], the app will not quit and no further CancelClose or Close events will be sent.
+
If a [[Window.CancelClosing|CancelClosing]] event handler returns [[False]] (the default action) then the window's [[Window.Closing|Closing]] event handler will be executed. If any window's [[Window.Closing|Closing]] event handler returns [[True]], the app will not quit and no further CancelClosing or Closing events will be sent.
  
 
An [[EndException]] is raised when you call [[Quit]]. It causes the application to quit gracefully. Usually you do not see the [[EndException]] unless you use a "catch-all" [[Exception]] statement.
 
An [[EndException]] is raised when you call [[Quit]]. It causes the application to quit gracefully. Usually you do not see the [[EndException]] unless you use a "catch-all" [[Exception]] statement.

Revision as of 14:35, 26 July 2019

Method

Quits the application.

Syntax

Quit([status])

Part Type Description
status Integer For console applications only, the optional parameter returns a status code.

When you call Quit, it will terminate your application and returns the status code in status.

Notes

Calling the Quit method will call the Application class’s CancelClosing event. To cancel the close, return True from this event. If it does not return True, each window's CancelClosing event handler will execute. CancelClose and Close are called as a pair for each open window.

If a CancelClosing event handler returns False (the default action) then the window's Closing event handler will be executed. If any window's Closing event handler returns True, the app will not quit and no further CancelClosing or Closing events will be sent.

An EndException is raised when you call Quit. It causes the application to quit gracefully. Usually you do not see the EndException unless you use a "catch-all" Exception statement.

If you just need to have your app quit when last window is closed, you can use the Application.AutoQuit property.

Examples

This example quits the application.

Quit

See Also

Application, QuitMenuItem, EndException classes.