App
From Xojo Documentation
Returns the instance of the appropriate application object used by the app. This varies by project type.
Usage
App.Property = value
or
App.Method
Part | Description |
---|---|
Property | Any valid property of the appropriate Application, WebApplication, ConsoleApplication, ServiceApplication, iOSApplication class (based on your project type). |
value | Any valid method or property of the appropriate Application, WebApplication, ConsoleApplication, ServiceApplication, iOSApplication class (based on your project type). |
Method | Any valid method of the appropriate Application, WebApplication, ConsoleApplication, ServiceApplication, iOSApplication class (based on your project type). |
Notes
This method returns a specific instance of an application class, depending on the app type:
Global Information
The application class can be a useful place to store information that needs to be global for the project. For example, an app might store its preferences in a Dictionary as a public property of the App object to make it accessible throughout the project. When you do this, you refer to the property by using the App prefix:
App Can Return Nil
It is possible for the App method to return Nil under certain circumstances. The App method returns the global application object only after it has been registered with the runtime. That means that any operations which happen before this registration process cannot rely on App returning non-nil. This is concern only very early in the program initialization stages; by the time the Application.Open event fires you can be certain that App will return non-nil. The most common cases for App returning Nil are:
- Within a constructor for the Application object itself.
- Within menu item constructors when the menu bar is attached to the app class.
It is possible that there are other cases, so do not rely on these being the only two.
Sample Code
In a desktop or web app, turns on AutoQuit so that the app quits when all its Windows are closed or all its Sessions are disconnected:
See Also
Application, ConsoleApplication, Session, ServiceApplication, WebApplication, WebSession, iOSApplication classes