<div class="meta" robots="noindex">

</div>

Class

# Application

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2021r3. Please use `DesktopApplication</api/user_interface/desktop/desktopapplication>` as a replacement.

</div>

## Description

Contains properties, methods, and events for managing desktop applications.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                               | Type                                                      | Read-Only | Shared |
|----------------------------------------------------|-----------------------------------------------------------|-----------|--------|
| `AllowAutoQuit<application.allowautoquit>`         | `Boolean</api/data_types/boolean>`                        |           |        |
| `AllowDarkMode<application.allowdarkmode>`         | `Boolean</api/data_types/boolean>`                        | ✓         |        |
| `AllowHiDPI<application.allowhidpi>`               | `Boolean</api/data_types/boolean>`                        | ✓         |        |
| `BugVersion<application.bugversion>`               | `Integer</api/data_types/integer>`                        | ✓         |        |
| `BuildDateTime<application.builddatetime>`         | `DateTime</api/data_types/datetime>`                      | ✓         |        |
| `Copyright<application.copyright>`                 | `String</api/data_types/string>`                          | ✓         |        |
| `Description<application.description_property>`    | `String</api/data_types/string>`                          | ✓         |        |
| `DockItem<application.dockitem>`                   | `DockItem</api/macos/dockitem>`                           |           |        |
| `ExecutableFile<application.executablefile>`       | `FolderItem</api/files/folderitem>`                       | ✓         |        |
| `LastWindowIndex<application.lastwindowindex>`     | `Integer</api/data_types/integer>`                        | ✓         |        |
| `MajorVersion<application.majorversion>`           | `Integer</api/data_types/integer>`                        | ✓         |        |
| `MDIWindow<application.mdiwindow>`                 | `MDIWindow</api/user_interface/desktop/desktopmdiwindow>` |           |        |
| `MenuBar<application.menubar>`                     | `MenuBar</api/deprecated/menubar>`                        |           |        |
| `MinorVersion<application.minorversion>`           | `Integer</api/data_types/integer>`                        | ✓         |        |
| `MouseCursor<application.mousecursor>`             | `MouseCursor</api/user_interface/desktop/mousecursor>`    |           |        |
| `NonReleaseVersion<application.nonreleaseversion>` | `Integer</api/data_types/integer>`                        | ✓         |        |
| `RegionCode<application.regioncode>`               | `Integer</api/data_types/integer>`                        | ✓         |        |
| `StageCode<application.stagecode>`                 | `Integer</api/data_types/integer>`                        | ✓         |        |
| `Version<application.version>`                     | `String</api/data_types/string>`                          | ✓         |        |
| `WindowCount<application.windowcount>`             | `Integer</api/data_types/integer>`                        | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                            | Parameters                                                                                                                                                                | Returns                            | Shared |
|-------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `AddTrayItem<application.addtrayitem>`          | Item As `TrayItem</api/deprecated/trayitem>`                                                                                                                              | `Boolean</api/data_types/boolean>` |        |
| `DoEvents<application.doevents>`                | \[milliseconds As `Integer</api/data_types/integer>`\]                                                                                                                    |                                    |        |
| `HideTooltip<application.hidetooltip>`          |                                                                                                                                                                           |                                    |        |
| `NewDocument<application.newdocument_method>`   |                                                                                                                                                                           |                                    |        |
| `OpenDocument<application.opendocument_method>` | File As `FolderItem</api/files/folderitem>`                                                                                                                               |                                    |        |
| `RefreshMenuBar<application.refreshmenubar>`    |                                                                                                                                                                           |                                    |        |
| `RemoveTrayItem<application.removetrayitem>`    | Item As `TrayItem</api/deprecated/trayitem>`                                                                                                                              |                                    |        |
| `ShowTooltip<application.showtooltip>`          | tip As `String</api/data_types/string>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, autoHide As `Boolean</api/data_types/boolean>` |                                    |        |
| `Window<application.window>`                    | index As `Integer</api/data_types/integer>`                                                                                                                               | `Window</api/deprecated/window>`   |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                 | Parameters                                                                                                                                | Returns                            |
|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `Activate<application.activate>`                     |                                                                                                                                           |                                    |
| `AppearanceChanged<application.appearancechanged>`   |                                                                                                                                           |                                    |
| `CancelClose<application.cancelclose>`               |                                                                                                                                           | `Boolean</api/data_types/boolean>` |
| `Close<application.close>`                           |                                                                                                                                           |                                    |
| `Deactivate<application.deactivate>`                 |                                                                                                                                           |                                    |
| `EnableMenuItems<application.enablemenuitems>`       |                                                                                                                                           |                                    |
| `HandleAppleEvent<application.handleappleevent>`     | Event As `AppleEvent</api/macos/appleevent>`, EventClass As `String</api/data_types/string>`, EventID As `String</api/data_types/string>` | `Boolean</api/data_types/boolean>` |
| `NewDocument<application.newdocument_event>`         |                                                                                                                                           |                                    |
| `Open<application.open>`                             |                                                                                                                                           |                                    |
| `OpenDocument<application.opendocument_event>`       | File As `FolderItem</api/files/folderitem>`                                                                                               |                                    |
| `UnhandledException<application.unhandledexception>` | error As `RuntimeException</api/exceptions/runtimeexception>`                                                                             | `Boolean</api/data_types/boolean>` |

## Constants

The following class constants can be used to specify the value of the StageCode property.

| Constant    | Value |
|-------------|-------|
| Development | 0     |
| Alpha       | 1     |
| Beta        | 2     |
| Final       | 3     |

## Property descriptions

<div id="application.allowautoquit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.AllowAutoQuit

**AllowAutoQuit** As `Boolean</api/data_types/boolean>`

When `True</api/language/true>`, the <span class="title-ref">Application</span> quits when the last window is closed, whether by calling the Close method of the `Window</api/deprecated/window>` class or by the user closing the last window manually.

AllowAutoQuit defaults to `True</api/language/true>` on non-MDI Windows applications and `True</api/language/true>` on Linux. It defaults to `False</api/language/false>` on MDI Windows and macOS applications.

This code is in the `Open<application.open>` event of the App class.

``` xojo
App.AllowAutoQuit = True
```

<div id="application.allowdarkmode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.AllowDarkMode

**AllowDarkMode** As `Boolean</api/data_types/boolean>`

You can only set this property in the Inspector for the App object. Set to ON to make the app run in dark mode when dark mode is set in the OS settings. This is set to False by default.

This property is read-only.

For macOS, Dark mode is only relevant on macOS Mojave (10.14) or later.

<div id="application.allowhidpi">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.AllowHiDPI

**AllowHiDPI** As `Boolean</api/data_types/boolean>`

You can only set this property in the Inspector for the App object. Set to ON to make the app HiDPI-aware. This is set to True by default.

This property is read-only.

You can read this property at runtime:

``` xojo
If App.AllowHiDPI Then
  ' HiDPI is enabled
Else
  ' HiDPI is not enabled
End If
```

When AllowHiDPI is turned OFF, the framework will continue to work the way it did before. Images that use @2x or @3x in the name will have their PPI (points per inch) adjusted accordingly (144ppi, 216ppi).

You can turn the AllowHiDPI property on or off dynamically by using an IDE Script. This turns it on:

``` xojo
PropertyValue("App.AllowHiDPI") = "True"
```

Use the text "False" to turn it off.

When AllowHiDPI is turned ON, the framework will NOT change the ppi when an image with @2x or @3x in its name is loaded. It is up to you to set the PPI (which is most easily handled using an Image Set). The reason for this is so that if you need access to the image's original PPI, you'll be able to get it by manually loading the image and setting is PPI.

If you want to set the PPI automatically based on its name, you can use this method:

``` xojo
Sub SetImageResolutionFromName(p As Picture, filename As String)
  Var r As New RegEx
  r.SearchPattern = "@([0-9.]+)x\."

  Var rm As RegExMatch = r.Search(filename)
  If rm <> Nil And rm.SubExpressionCount > 0 Then
    Var n As Double = CDbl(rm.SubExpressionString(1))
    p.HorizontalResolution = 72 * n
    p.VerticalResolution = 72 * n
  End If
End Sub
```

<div id="application.bugversion">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.BugVersion

**BugVersion** As `Integer</api/data_types/integer>`

The version you increment when the release of your <span class="title-ref">Application</span> is only to fix critical and unexpected bugs in the previous release.

This property is read-only.

This can only be set in the IDE, but you can read the value in your code.

Typically version numbers are written as 1.2.3.4 (MajorVersion.MinorVersion.BugVersion.NonReleaseVersion).

<div class="note">

<div class="title">

Note

</div>

On Windows valid values are between 0 to 255.

</div>

Puts all the individual versions together to create the full version:

``` xojo
Var fullVersion As String
fullVersion = app.MajorVersion.ToString + "." + app.MinorVersion.ToString + "." _
  + app.BugVersion.ToString + "." + app.NonReleaseVersion.ToString.
```

<div id="application.builddatetime">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.BuildDateTime

**BuildDateTime** As `DateTime</api/data_types/datetime>`

Contains the date and time when the <span class="title-ref">Application</span> was built.

This property is read-only.

You can also access the `CreationDateTime<folderitem.creationdatetime>` property of the <span class="title-ref">Application</span>'s `FolderItem</api/files/folderitem>` by calling App.ExecutableFile.CreationDate.

The following code gets the build date/time and displays it in a `Label</api/deprecated/label>`.

``` xojo
Var d As DateTime
d = App.BuildDateTime

Label1.Text = d.ToString
```

<div id="application.copyright">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Copyright

**Copyright** As `String</api/data_types/string>`

A longer text description for the app. Usually this contains the app name, copyright, version and other information. This is displayed by some operating systems in Get Info or Property windows for the app. This property can be set only in the IDE.

This property is read-only.

Display the copyright info:

``` xojo
MessageBox(App.Copyright)
```

<div id="application.description_property">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Description

**Description** As `String</api/data_types/string>`

A text description for the app that may be displayed by some operating systems in Get Info or Property windows for the app. This property can be set only in the IDE. This value is not displayed for macOS.

This property is read-only.

<div id="application.dockitem">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.DockItem

**DockItem** As `DockItem</api/macos/dockitem>`

Enables you to manipulate the dock item associated with the <span class="title-ref">Application</span> (macOS only).

The DockItem property enables you to access the properties and methods of the `DockItem</api/macos/dockitem>` class. This class has two methods, UpdateNow and ResetIcon, and one property, Graphics. Use the methods of the `Graphics</api/graphics/graphics>` class to modify the appearance of the icon. Since a macOS icon is intended to be scaled automatically, you should design it as a 512x512 pixel icon.

- ResetIcon resets the icon to its original state (default appearance).
- Call the UpdateNow method to redraw the icon.

You can also use the ClearRect property of the `Graphics</api/graphics/graphics>` class to start over from a blank icon. Anything you can do with a `Graphics</api/graphics/graphics>` object you are able to do with the Dock's Graphics object (like drawing in a picture or using a `Group2D</api/graphics/group2d>`). The DockItem property of the `Window</api/deprecated/window>` class enables you to control the dock item for individual windows.

<div id="application.executablefile">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.ExecutableFile

**ExecutableFile** As `FolderItem</api/files/folderitem>`

Returns a `FolderItem</api/files/folderitem>` for the actual executable <span class="title-ref">Application</span> even if it is in a bundle.

This property is read-only.

Application.ExecutableFile returns Nil if the app has been deleted or an error occurs finding it.

Use the properties and methods of the `FolderItem</api/files/folderitem>` class to get/set attributes of the executable file and/or perform operations. For example:

``` xojo
Var appPath As String
appPath = App.ExecutableFile.NativePath
```

gets the full path to the executable.

``` xojo
Var cd As DateTime
cd = App.ExecutableFile.CreationDateTime 
```

gets the date/time the executable was created.

You can get the location of the folder in which the app is running, by getting the `Parent<folderitem.parent>` of the executable file:

``` xojo
Var f As FolderItem
f = App.ExecutableFile.Parent
```

<div id="application.lastwindowindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.LastWindowIndex

**LastWindowIndex** As `Integer</api/data_types/integer>`

Returns the index of the last window the app opened.

This property is read-only.

<div id="application.majorversion">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.MajorVersion

**MajorVersion** As `Integer</api/data_types/integer>`

The version to be incremented when the release includes many large new features.

This property is read-only.

This can only be set in the IDE, but you can read the value in your code.

Typically version numbers are written as 1.2.3.4 (MajorVersion.MinorVersion.BugVersion.NonReleaseVersion).

<div class="note">

<div class="title">

Note

</div>

On Windows valid values are between 0 to 255.

</div>

Puts all the individual versions together to create the full version:

``` xojo
Var fullVersion As String
fullVersion = app.MajorVersion.ToString + "." + app.MinorVersion.ToString + "." _
  + app.BugVersion.ToString + "." + app.NonReleaseVersion.ToString.
```

<div id="application.mdiwindow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.MDIWindow

**MDIWindow** As `MDIWindow</api/user_interface/desktop/desktopmdiwindow>`

Provides access to the properties and methods of the `MDIWindow</api/user_interface/desktop/desktopmdiwindow>` class.

Valid only for Windows apps that are built using the Multiple Document Interface option.

This code sets the Title property of the app's MDI window.

``` xojo
App.MDIWindow.Title = "The MDI Window Title"
```

<div id="application.menubar">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.MenuBar

**MenuBar** As `MenuBar</api/deprecated/menubar>`

Represents the <span class="title-ref">Application</span>'s global menubar. Its children are the menus.

The <span class="title-ref">Application</span> MenuBar is used by macOS when a Window does not have a specified `MenuBar<window.menubar>`. It is also used by MDI applications on Windows to display the MDI window MenuBar.

The <span class="title-ref">Application</span> MenuBar property is not used by non-MDI Windows applications or Linux applications.

However, if the <span class="title-ref">Application</span> MenuBar property is specified, it will be automatically filled in as the MenuBar on any new Windows you create.

This line of code in the Open event of the App class sets the menubar to a user-created menubar. This can also be done in the Properties pane in the IDE.

``` xojo
App.MenuBar = MenuBar2
```

<div id="application.minorversion">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.MinorVersion

**MinorVersion** As `Integer</api/data_types/integer>`

The version you increment when the release is does not add any major features.

This property is read-only.

This can only be set in the IDE, but you can read the value in your code.

Typically version numbers are written as 1.2.3.4 (MajorVersion.MinorVersion.BugVersion.NonReleaseVersion).

<div class="note">

<div class="title">

Note

</div>

On Windows valid values are between 0 to 255.

</div>

Puts all the individual versions together to create the full version:

``` xojo
Var fullVersion As String
fullVersion = app.MajorVersion.ToString + "." + app.MinorVersion.ToString + "." _
  + app.BugVersion.ToString + "." + app.NonReleaseVersion.ToString.
```

<div id="application.mousecursor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.MouseCursor

**MouseCursor** As `MouseCursor</api/user_interface/desktop/mousecursor>`

The cursor that is displayed while the <span class="title-ref">Application</span> is running and the pointer is within one of the <span class="title-ref">Application</span>'s windows.

On Mac, it is also the cursor that is displayed when the app is frontmost and the pointer moves outside of any of the app's windows. On Windows and Linux, the pointer changes back to the default pointer when it exits an <span class="title-ref">Application</span> window. If the <span class="title-ref">Application</span> class MouseCursor is not `Nil</api/language/nil>`, the non-Nil MouseCursor properties belonging to any `Window</api/deprecated/window>` or `Control</api/deprecated/control>` are ignored.

You can use the cursors in the `Cursors</api/user_interface/desktop/cursors>` module to set the mouse cursor.

This line in the Open event of the App class sets the default cursor to the finger pointer.

``` xojo
App.MouseCursor = System.Cursors.FingerPointer
```

<div id="application.nonreleaseversion">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.NonReleaseVersion

**NonReleaseVersion** As `Integer</api/data_types/integer>`

The version you increment each time you build your project.

This property is read-only.

This can only be set in the IDE, but you can read the value in your code.

Some platforms also refer to this as the build or revision number.

Typically version numbers are written as 1.2.3.4 (MajorVersion.MinorVersion.BugVersion.NonReleaseVersion).

If AutoIncrementVersionInformation is checked, the IDE increases NonReleaseVersion by one each time you build your project, but not when you run it.

<div class="note">

<div class="title">

Note

</div>

On Windows valid values are between 0 to 255.

</div>

If your app is rejected by an App Store for something minor, you can resolve it then increment this number to (in most cases) sufficiently distinguish it from the version you previously submitted.

Puts all the individual versions together to create the full version:

``` xojo
Var fullVersion As String
fullVersion = app.MajorVersion.ToString + "." + app.MinorVersion.ToString + "." _
  + app.BugVersion.ToString + "." + app.NonReleaseVersion.ToString.
```

<div id="application.regioncode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.RegionCode

**RegionCode** As `Integer</api/data_types/integer>`

The Region Code of the <span class="title-ref">Application</span>, corresponding to the version information. Not supported on Windows. This property can be set only in the IDE.

This property is read-only.

<div id="application.stagecode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.StageCode

**StageCode** As `Integer</api/data_types/integer>`

Stage Code of the <span class="title-ref">Application</span>, corresponding to the version information.

This property is read-only.

Use the four <span class="title-ref">Application</span> class constants to set/get the Stage. Stage can be set only in the IDE.

| Value | Description |
|-------|-------------|
| 0     | Development |
| 1     | Alpha       |
| 2     | Beta        |
| 3     | Final       |

<div id="application.version">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Version

**Version** As `String</api/data_types/string>`

A short text description for the app. Usually this contains just the version number (such as 1.2.3.4) and is displayed by some operating systems in Get Info or Property windows for the app. This property can be set only in the IDE.

This property is read-only.

Typically version numbers are written as 1.2.3.4.

Version is displayed by the file information windows on macOS (Finder, Get Info) and Windows (Windows Explorer, Properties).

Display the short version:

``` xojo
MessageBox(App.Version)
```

<div id="application.windowcount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.WindowCount

**WindowCount** As `Integer</api/data_types/integer>`

Returns the number of open windows.

This property is read-only.

The WindowCount property includes any windows that are invisible. If called during a window's `Open<window.open>` event, it includes that window. If called during a window's `Close<window.close_event>` event, it does not include that window.

## Method descriptions

<div id="application.addtrayitem">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.AddTrayItem

**AddTrayItem**(Item As `TrayItem</api/deprecated/trayitem>`) As `Boolean</api/data_types/boolean>`

Adds the passed item to the System Tray via the `TrayItem</api/deprecated/trayitem>` class.

AddTrayItem returns a `Boolean</api/data_types/boolean>` that indicates success or failure. If it returns `True</api/language/true>`, the `TrayItem</api/deprecated/trayitem>` was added successfully. The System Tray is supported on Windows and Linux only. See the `TrayItem</api/deprecated/trayitem>` class.

<div id="application.doevents">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.DoEvents

**DoEvents**(\[milliseconds As `Integer</api/data_types/integer>`\])

Yields time back to your app when in loops. Intended for console applications in which there is no main event loop.

<div id="application.hidetooltip">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.HideTooltip

**HideTooltip**

Hides the tooltip. Call this if the *AutoHide* parameter of the `ShowTooltip<application.showtooltip>` method was `False</api/language/false>`.

Call this if you had passed `False</api/language/false>` to the corresponding call to `ShowTooltip<application.showtooltip>` or you are not programming for macOS and need to hide the tooltip manually.

``` xojo
App.HideTooltip
```

<div id="application.newdocument_method">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.NewDocument

**NewDocument**

Calls the NewDocument event handler.

<div id="application.opendocument_method">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.OpenDocument

**OpenDocument**(File As `FolderItem</api/files/folderitem>`)

Calls the OpenDocument event handler.

<div id="application.refreshmenubar">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.RefreshMenuBar

**RefreshMenuBar**

Forces an update of the menu bar and calls EnableMenu and EnableMenuItem event handlers.

In most cases, the standard menu bar updating will be sufficient. There are cases, however, when it's not. For example, if the SelChange event handler of a `TextField</api/deprecated/textfield>` control causes all of the menu items in a particular menu to be disabled, the menu itself should be disabled. Unfortunately, it won't be because the user has not yet clicked in the menu bar. Under circumstances like this, you can call the RefreshMenuBar method to force your app to only update the menus based on your own conditions.

Calling this calls EnableMenu or EnableMenuItem event handlers on <span class="title-ref">Application</span>, Window, ContainerControl and MenuItem.

``` xojo
App.RefreshMenuBar
```

<div id="application.removetrayitem">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.RemoveTrayItem

**RemoveTrayItem**(Item As `TrayItem</api/deprecated/trayitem>`)

Removes the passed item from the System Tray via the `TrayItem</api/deprecated/trayitem>` class.

<div id="application.showtooltip">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.ShowTooltip

**ShowTooltip**(tip As `String</api/data_types/string>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, autoHide As `Boolean</api/data_types/boolean>`)

Pops up the passed tip at the global coordinates given by *x*, *y* (relative to the screen). If *AutoHide* is `True</api/language/true>`, then the tip will automatically hide itself; you do not have to call `HideTooltip<application.hidetooltip>` to hide it. The default is `True</api/language/true>`.

*AutoHide* is used only on Windows and Linux; on macOS, the ToolTip hides automatically.

The following code is placed in the `MouseDown<window.mousedown>` event of a `window</api/deprecated/window>`. It uses the *X* and *Y* coordinates passed into the event.

``` xojo
App.ShowTooltip("This is my tip", Self.Left + X, Self.Top + Y)
Return True
```

The following code in the `Action<pushbutton.action>` event of a `PushButton</api/deprecated/pushbutton>` displays the contents of a `TextField</api/deprecated/textfield>` as a tip.

``` xojo
App.ShowTooltip(TextField1.Text, System.MouseX, System.MouseY + 20)
```

<div id="application.window">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Window

**Window**(index As `Integer</api/data_types/integer>`) As `Window</api/deprecated/window>`

Returns a reference to an open window.

The Window function returns a reference to the window number passed. The window list contains all the windows that have been created. Window zero is the frontmost window. Floating windows are always in front of document windows. For example, to get the frontmost document window when you also have Floating windows, you must also check each window's Frame property. In evaluating the order of windows in the list from front to back, keep in mind that a window may not have its Visible property set to `True</api/language/true>`. If this may be the case, check the Visible property of a window while identifying the frontmost visible window. If you don't, the code may identify the frontmost window as a window that is not Visible.

This function can be used in conjunction with the `WindowCount<application.windowcount>` function to loop through the open windows. Note that during a window's `Open<window.open>` event, the window list includes that window, but during a window's `Close<window.close_event>` event, the window list does not include that window.

If you pass in a window number that does not exist ( a value \< 0 or \>= `WindowCount<application.windowcount>`) then this function returns Nil.

This code places the titles of all open windows into a `ListBox</api/deprecated/listbox>`:

``` xojo
For i As Integer = App.WindowCount - 1 DownTo 0
  Var w As Window = App.Window(i)
  If w <> Nil Then
    ListBox1.AddRow(w.Title)
  End If
Next
```

This code gets the frontmost Document window. It considers only Document windows (`Window.Type<window.type>` = `Window.Types.Document<window.types>`) and takes into account the possibility that a window might not be visible:

``` xojo
Var frontmostDocumentWindow As Window
Var lastOffset As Integer = App.WindowCount - 1
For i As Integer = 0 To lastOffset
  Var w As Window = System.Window(i)
  If (w <> Nil) And (w.Type = Window.Types.Document) And w.Visible Then
    frontmostDocumentWindow = w
    Exit
  End If
Next
Return frontmostDocumentWindow
```

## Event descriptions

<div id="application.activate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Activate

**Activate**

The app is being activated.

When the app is launched, the Open event is called prior to Activate.

<div id="application.appearancechanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.AppearanceChanged

**AppearanceChanged**

Called when a user switches between Light and Dark mode, when the accent color changes or on macOS when the user changes any accessibility system preferences that affect the appearance of the app.

Use this event to update any graphics or other UI as needed.

On macOS, you can use `declares</api/language/declare>` to determine which accessibility settings the user changed. Details on that can be found in Apple's [documentation](https://developer.apple.com/documentation/appkit/nsworkspace?language=objc).

<div id="application.cancelclose">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.CancelClose

**CancelClose** As `Boolean</api/data_types/boolean>`

This event occurs first when the <span class="title-ref">Application</span> is about to terminate, e.g. if you used the `Quit</api/language/quit>` command or if the user chose *Quit* from the menu. Return `True</api/language/true>` to cause the termination to stop.

This is the order in which events are called when a GUI <span class="title-ref">Application</span> initiates a termination process, i.e. when it quits: \# `CancelClose<application.cancelclose>` is called first. If, for any reason, you want to stop the termination process or interact with the user (use a modal window in such a case) to confirm, you should do it in this event. If you return `True</api/language/true>`, the termination process will be stopped immediately. \# `Window.CancelClose<window.cancelclose>` is then called for each `Window</api/deprecated/window>`, one after the other. If **any** `Window.CancelClose<window.cancelclose>` returns `True</api/language/true>`, the termination process will be stopped. \# Windows are all closed, one after the other. In the process, each `Window</api/deprecated/window>` event is called but you can no longer interrupt the termination process. \# If you use asynchronous object like `` Thread</api/language/threading/thread>`s, :doc:`Timer</api/language/timer>`s or sockets, they are terminated by the runtime environment then destroyed even if the runtime did not or could not stop them. If such objects are subclasses and have a :doc:`Destructor</api/language/destructor> `` event, it will be called. \# The `Close<application.close>` event is called.

**Note** that some objects can be destroyed (so their `Destructor</api/language/destructor>` event called) **after** the `Close<application.close>` event has been invoked.

<div id="application.close">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Close

**Close**

The app is quitting.

`Close<application.close>` is called after `CancelClose<application.cancelclose>` and after the window's `CancelClose<window.cancelclose>` and `Close<window.close_event>` events.

There is nothing you can do to abort the quitting process at that time. If you need to control if your app is allowed to quit in the current context, use `CancelClose<application.cancelclose>` or `Window.CancelClose<window.cancelclose>`.

<div id="application.deactivate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Deactivate

**Deactivate**

The app is being deactivated.

For example, this occurs when the user clicks on a window belonging to another app. When the user clicks on your app window again, the Activate event is called.

<div id="application.enablemenuitems">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.EnableMenuItems

**EnableMenuItems**

Called when the user clicks in the menubar to give you the opportunity to determine which menu items to enable.

It also is called when the app opens if no default window is selected for the project and when the last window is closed.

<div id="application.handleappleevent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.HandleAppleEvent

**HandleAppleEvent**(Event As `AppleEvent</api/macos/appleevent>`, EventClass As `String</api/data_types/string>`, EventID As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

An `AppleEvent</api/macos/appleevent>` has been received.

`Return</api/language/return>` `True</api/language/true>` to accept the `AppleEvent</api/macos/appleevent>` and `False</api/language/false>` to reject it.

Intrinsic AppleEvents, such as "aevt/odoc", "aevt/quit", and "aevt/pref", are passed to this event handler first. If you return `True</api/language/true>`, the default behavior will no longer take place. For example, if you return `True</api/language/true>` for the "odoc" event, the OpenDocument event will not be called.

<div id="application.newdocument_event">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.NewDocument

**NewDocument**

The user launched the app by double-clicking the app icon or the NewDocument method was called.

<div id="application.open">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.Open

**Open**

The app is opening.

The Open event is the first event called when your app starts.

The `Activate<application.activate>` event is called after the Open event.

<div id="application.opendocument_event">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.OpenDocument

**OpenDocument**(File As `FolderItem</api/files/folderitem>`)

The user has double-clicked on a document which this app is specified to open or the OpenDocument method was called.

<div id="application.unhandledexception">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Application.UnhandledException

**UnhandledException**(error As `RuntimeException</api/exceptions/runtimeexception>`) As `Boolean</api/data_types/boolean>`

If a `RuntimeException</api/exceptions/runtimeexception>` is not caught anywhere else (using `Exception</api/exceptions/exception>` or `Try</api/language/try>`), this event is called so you may handle the exception. Return `True</api/language/true>` to suppress the quit behavior. Return `False</api/language/false>` to use the default quit behavior.

If a `RuntimeException</api/exceptions/runtimeexception>` is not caught anywhere else, this event is called so you may handle the exception. See the example.

This code in the UnhandledException event of the App class catches any unhanded exceptions and displays the name of the exception along with the error stack:

``` xojo
If error <> Nil Then
  Var type As String = Introspection.GetType(error).Name
  MessageBox(type + EndOfLine + EndOfLine + String.FromArray(error.Stack, EndOfLine))
End If
```

## Notes

<div class="note">

<div class="title">

Note

</div>

For web apps, refer to `WebApplication</api/web/webapplication>`. For console apps, refer to `ConsoleApplication</api/console/consoleapplication>`. For iOS apps, refer to `MobileApplication</api/mobile/mobileapplication>`.

</div>

A subclass of <span class="title-ref">Application</span> (called App) is automatically added when you create a new Desktop project. This new subclass gives you access to the <span class="title-ref">Application</span> class methods and events.

The App subclass has its own menu handlers which can be used to handle menu items when no windows are open or for menu items that should call the same menu handler regardless of which window is frontmost. You can change the global menubar by assigning a different menubar to its MenuBar property.

See the `Control</api/deprecated/control>` class for information on changing the cursor and adding cursors to your project.

The `App</api/language/app>` function returns a reference to an instance of the subclass of <span class="title-ref">Application</span> in your project. See the `App</api/language/app>` function for more information.

To change the app icon, click the Icon that is displayed in the Inspector when the App object is selected. Refer to `App Icons</topics/application_structure/app_icons>` for more information.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Adding additional application subclasses

If you wish, you can add additional subclasses based on the <span class="title-ref">Application</span> class to the project, but it is not necessary. If you do so, the one that is added to the project automatically is the one referred to by the `App</api/language/app>` function and it is the one that will show the project's build settings.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Version information

If AutoIncrementVersionInformation is checked (a design-time property) then the NonReleaseVersion property is increased by one each time you do a build (but not when you run the project).

The compiler truncates version information when building Windows applications when the version information is too long to store into the executable file. The current byte limitations for these fields are as follows:

| Field         | Maximum length (bytes) |
|---------------|------------------------|
| Long Version  | 79                     |
| Short Version | 39                     |
| Package Info  | 253                    |
| Region        | 21                     |
| Release       | 11                     |

## Sample code

You can get the location of the folder in which the app is running, by getting the `Parent<folderitem.parent>` of the executable file:

``` xojo
Var f as FolderItem
f = App.ExecutableFile.Parent
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The following code in the Action event of a `PushButton</api/deprecated/pushbutton>` causes an `OutofBoundsException</api/exceptions/outofboundsexception>` runtime error when the counter, i, reaches the value of `System.FontCount<system.fontcount>`.

``` xojo
For i As Integer = 1 To FontCount
  ListBox1.AddRow(Font(i))
Next
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Since there is no exception handler within the method, the runtime exception is passed up to the <span class="title-ref">Application</span> class, triggering the UnhandledException event.

This code in the UnhandledException event of the App class "catches" the unhandled `OutOfBoundsException</api/exceptions/outofboundsexception>`. Of course, it catches all unhandled OutOfBoundsExceptions throughout the <span class="title-ref">Application</span>, so it doesn't know where the error occurred. You could instead place an Exception statement within the `PushButton</api/deprecated/pushbutton>`'s Action event so that you can provide more specific diagnostics.

``` xojo
Function UnhandledException(error As RuntimeException) As Boolean
  If error IsA OutOfBoundsException Then
    MessageBox("An OutOfBounds Exception error has occurred!")
  End If
  Return True
End Function
```

## Compatibility

All project types on all supported operating systems.

## See also

`Object</api/data_types/additional_types/object>` parent class; `App</api/language/app>`, `System</api/os/system>`, objects; `AppleEvent</api/macos/appleevent>`, `ConsoleApplication</api/console/consoleapplication>`, `MDIWindow</api/user_interface/desktop/desktopmdiwindow>`, `ServiceApplication</api/console/serviceapplication>`, `WebApplication</api/web/webapplication>`, `MobileApplication</api/mobile/mobileapplication>` classes.
