App

From Xojo Documentation

Revision as of 19:11, 19 November 2009 by WikiSysop (talk) (Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

An intrinsic instance of the Application class that represents the application.


Syntax

App.property=value
OR
App.method

Part Description
Property Any valid property of the Application class.
Value A value of the proper datatype for the Property.
Method Any valid method of the Application class.

Notes

The App class represents the application itself (as opposed to a window or control). This allows you access to the Application class's properties, events, and methods without having to explicitly store a reference to it. If you have created a class that is a subclass of type Application, the App class will return a reference to that class.

The default Desktop Application template includes an instance of the App class. In the IDE, the Properties pane for the App class includes numerous pseudo-properties that are described in the section "Customizing the Standalone Application's Properties" on page 694 of the User's Guide.

The App class has the Application class properties for the application. If you create additional subclasses of Application, they do not have these properties

It is possible for the App function to return Nil under certain circumstances. The App function will return the global application object only after its 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.

In the Project Editor, the App class's Super class is Application for Desktop Applications. If you create a Console Application, its Super class is ConsoleApplication.


Examples

This example changes the application's MouseCursor to the Wait cursor:

App.MouseCursor=System.Cursors.Wait

Note: Access to the application's resource fork is supported only on Macintosh. Check the value of the TargetMacOS constant before attempting to open a resourcefork.

See Also

Application, ConsoleApplication, MDIWindow, ServiceApplication classes; System module.