Method

App


Description

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 DesktopApplication, WebApplication, ConsoleApplication, ServiceApplication, MobileApplication class (based on your project type).

value

Any valid method or property of the appropriate DesktopApplication, WebApplication, ConsoleApplication, ServiceApplication, MobileApplication class (based on your project type).

Method

Any valid method of the appropriate DesktopApplication, WebApplication, ConsoleApplication, ServiceApplication, MobileApplication 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.PreferencesDict.Value("DefaultUser") = "Tina"

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.Opening 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:

App.AutoQuit = True

Compatibility

All project types on all supported operating systems.