Class

# DesktopDisplay

<div class="rst-class">

forsearch

</div>

Screen

<div class="rst-class">

forsearch

</div>

Display

<div class="rst-class">

forsearch

</div>

Monitor

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

## Description

Used to get information about the connected displays.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                | Type                               | Read-Only | Shared |
|-----------------------------------------------------|------------------------------------|-----------|--------|
| `AvailableHeight<desktopdisplay.availableheight>`   | `Integer</api/data_types/integer>` | ✓         |        |
| `AvailableLeft<desktopdisplay.availableleft>`       | `Integer</api/data_types/integer>` | ✓         |        |
| `AvailableTop<desktopdisplay.availabletop>`         | `Integer</api/data_types/integer>` | ✓         |        |
| `AvailableWidth<desktopdisplay.availablewidth>`     | `Integer</api/data_types/integer>` | ✓         |        |
| `ColorDepth<desktopdisplay.colordepth>`             | `Integer</api/data_types/integer>` | ✓         |        |
| `DisplayCount<desktopdisplay.displaycount>`         | `Integer</api/data_types/integer>` | ✓         | ✓      |
| `Height<desktopdisplay.height>`                     | `Integer</api/data_types/integer>` | ✓         |        |
| `LastDisplayIndex<desktopdisplay.lastdisplayindex>` | `Integer</api/data_types/integer>` | ✓         | ✓      |
| `Left<desktopdisplay.left>`                         | `Integer</api/data_types/integer>` | ✓         |        |
| `ScaleFactor<desktopdisplay.scalefactor>`           | `Double</api/data_types/double>`   | ✓         |        |
| `Top<desktopdisplay.top>`                           | `Integer</api/data_types/integer>` | ✓         |        |
| `Width<desktopdisplay.width>`                       | `Integer</api/data_types/integer>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                  | Parameters                                  | Returns        | Shared |
|---------------------------------------|---------------------------------------------|----------------|--------|
| `DisplayAt<desktopdisplay.displayat>` | index As `Integer</api/data_types/integer>` | DesktopDisplay | ✓      |

## Property descriptions

<div id="desktopdisplay.availableheight">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.AvailableHeight

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

> The available height (in pixels) of the specified display, taking into account the menubar and/or the taskbar (Dock on macOS), if present.
>
> Use the `DisplayAt<desktopdisplay.displayat>` method to call AvailableHeight. For example, `DisplayAt<desktopdisplay.displayat>`(0).AvailableHeight returns the available height of the main display.
>
> This property is read-only.

<div id="desktopdisplay.availableleft">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.AvailableLeft

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

> The starting position of the left edge of the specified display. This would be zero unless, for example, the user had placed the taskbar (Windows and Linux) or the Dock (macOS) on the left.
>
> Use the `DisplayAt<desktopdisplay.displayat>` method to call AvailableLeft. For example, `DisplayAt<desktopdisplay.displayat>`(0).AvailableLeft returns the available left number of points of the main display.
>
> This property is read-only.

<div id="desktopdisplay.availabletop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.AvailableTop

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

> The starting position of the top edge of the specified display after taking into account the height of any menubar or taskbar, if present.
>
> Use the `DisplayAt<desktopdisplay.displayat>` method to call AvailableTop. For example, `DisplayAt<desktopdisplay.displayat>`(0).AvailableTop returns the available top number of pixels of the main display.
>
> This property is read-only.

<div id="desktopdisplay.availablewidth">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.AvailableWidth

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

> The available width (in pixels) of the display, taking into account the taskbar if placed on the left or right of the specified display.
>
> Use the `DisplayAt<desktopdisplay.displayat>` method to call AvailableWidth. For example, `DisplayAt<desktopdisplay.displayat>`(0).AvailableWidth returns the available width of the main display.
>
> This property is read-only.

<div id="desktopdisplay.colordepth">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.ColorDepth

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

> The color depth (in bits) of the display. Most screens use 32-bit color.
>
> This property is read-only.
>
> This example returns the depth of the user's main display:
>
> ``` xojo
> Var cd As Integer = DesktopDisplay.DisplayAt(0).ColorDepth
> ```

<div id="desktopdisplay.displaycount">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.DisplayCount

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

> Used to determine the number of displays connected to the user's computer.
>
> This property is read-only.
>
> This property is `shared</api/language/shared>`.
>
> The DisplayCount function returns the number of displays (monitors) connected to the user's computer (Windows and macOS). On Linux, DisplayCount always returns 1.
>
> This example reports on the number of monitors attached to the user's computer.
>
> ``` xojo
> Var myDisplays As Integer
> myDisplays = DesktopDisplay.DisplayCount
> If myDisplays = 1 Then
>   MessageBox("You have only one display.")
> Else
>   MessageBox("You have " + myDisplays.ToString + " displays!")
> End If
> ```

<div id="desktopdisplay.height">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.Height

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

> The height of the display in points. Use the `DisplayAt<desktopdisplay.displayat>` method to call Height. For example, `DisplayAt<desktopdisplay.displayat>`(0).Height returns the height of the main display.
>
> This property is read-only.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This value is scaled based upon the `ScaleFactor<desktopdisplay.scalefactor>`.
>
> </div>

<div id="desktopdisplay.lastdisplayindex">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.LastDisplayIndex

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

> The index of the last display connected to the user's computer. Display 0 is the main display. This can be useful when you need to loop through the user's displays.
>
> This property is read-only.
>
> This property is `shared</api/language/shared>`.
>
> This example finds the maximum screen depth of all displays connected to the user's computer:
>
> ``` xojo
> Var maxDepth As Integer
> For i As Integer = 0 To DesktopDisplay.LastDisplayIndex
>   Var currentDisplayDepth As Integer
>   currentDisplayDepth = DesktopDisplay.DisplayAt(i).ColorDepth
>   If currentDisplayDepth > maxDepth Then
>     maxDepth = currentDisplayDepth
>   End If
> Next
> ```

<div id="desktopdisplay.left">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.Left

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

> The left coordinate of the screen relative to the main display. For the main display, it is zero. Use the `DisplayAt<desktopdisplay.displayat>` method to call Left. For example, `DisplayAt<desktopdisplay.displayat>`(0).Left returns the left coordinate of the main display.
>
> This property is read-only.

<div id="desktopdisplay.scalefactor">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.ScaleFactor

**ScaleFactor** As `Double</api/data_types/double>`

> The ScaleFactor for the display.
>
> This property is read-only.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> A ScaleFactor of 1.0 indicates that each point refers to a single pixel on the screen. Higher values indicate a HiDPI display of some kind is being used.
>
> </div>
>
> ``` xojo
> Var scale As Double = DesktopDisplay.DisplayAt(0).ScaleFactor
> ```

<div id="desktopdisplay.top">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.Top

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

> The top coordinate of the display relative to the main display. For the main display, it is zero. Use the `DisplayAt<desktopdisplay.displayat>` method to call Top. For example, `DisplayAt<desktopdisplay.displayat>`(0).Top returns the top coordinate of the main display.
>
> This property is read-only.

<div id="desktopdisplay.width">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.Width

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

> The width of the display. Use the `DisplayAt<desktopdisplay.displayat>` method to call Width. For example, `DisplayAt<desktopdisplay.displayat>`(0).Width returns the width of the main display.
>
> This property is read-only.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This value is scaled based upon the `ScaleFactor<desktopdisplay.scalefactor>`.
>
> </div>

## Method descriptions

<div id="desktopdisplay.displayat">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopDisplay.DisplayAt

**DisplayAt**(index As `Integer</api/data_types/integer>`) As DesktopDisplay

> Used to access the properties of a <span class="title-ref">DesktopDisplay</span> object. Returns a reference to the display passed.
>
> This method is `shared</api/language/shared>`.
>
> Use this function to access the display properties for the monitors attached to the user's computer. Display 0 is the main screen. You can use the `DisplayCount<desktopdisplay.displaycount>` function to determine how many screens exist.
>
> This example displays the size of the user's main display.
>
> ``` xojo
> MessageBox("Your main display is " + DesktopDisplay.DisplayAt(0).Width.ToString + _
>   " by " + DesktopDisplay.DisplayAt(0).Height.ToString + ".")
> ```

## Notes

Although you cannot create an object of type <span class="title-ref">DesktopDisplay</span>, you can access display objects through the <span class="title-ref">DesktopDisplay</span> class.

## Sample code

The following reports on the values of AvailableLeft, AvailableHeight, AvailableTop, and AvailableWidth for the main display. The value of AvailableHeight takes into account the height of the taskbar (Windows and Linux) and the Dock (macOS). If the user has these tools configured to display on the side, the AvailableWidth property takes them into account.

``` xojo
Var s As String
s = "Left=" + DesktopDisplay.DisplayAt(0).AvailableLeft.ToString + EndOfLine
s = s + "Width=" + DesktopDisplay.DisplayAt(0).AvailableWidth.ToString + EndOfLine
s = s + "Top=" + DesktopDisplay.DisplayAt(0).AvailableTop.ToString + EndOfLine
s = s + "Height=" + DesktopDisplay.DisplayAt(0).AvailableHeight.ToString + EndOfLine
MessageBox(s)
```

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |
