Class

# DockItem

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

## Description

Used to manage the icons for your application and application windows in the macOS Dock.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                          | Type                               | Read-Only | Shared |
|-------------------------------|------------------------------------|-----------|--------|
| `Graphics<dockitem.graphics>` | `Graphics</api/graphics/graphics>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                            | Parameters | Returns | Shared |
|---------------------------------|------------|---------|--------|
| `ResetIcon<dockitem.reseticon>` |            |         |        |
| `UpdateNow<dockitem.updatenow>` |            |         |        |

## Property descriptions

<div id="dockitem.graphics">

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

</div>

<div class="rst-class">

forsearch

</div>

DockItem.Graphics

**Graphics** As `Graphics</api/graphics/graphics>`

> Provides access to all the `Graphics</api/graphics/graphics>` class methods for drawing into the dock icon.
>
> This property is read-only.
>
> This code draws an image (that is part of the project) as the \`DockItem\`:
>
> ``` xojo
> App.DockItem.Graphics.DrawPicture(MyDockIcon, 0, 0, 128, 128)
> App.DockItem.UpdateNow
> ```

## Method descriptions

<div id="dockitem.reseticon">

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

</div>

<div class="rst-class">

forsearch

</div>

DockItem.ResetIcon

**ResetIcon**

> Resets the icon to its original state, its default appearance, and then draws a new icon.
>
> ``` xojo
> App.DockItem.ResetIcon
> App.DockItem.Graphics.DrawPicture(NewDockIcon, 0, 0, 128, 128)
> App.DockItem.UpdateNow
> ```

<div id="dockitem.updatenow">

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

</div>

<div class="rst-class">

forsearch

</div>

DockItem.UpdateNow

**UpdateNow**

> Redraws the icon.
>
> This code draws an image (that has been added to the project) as the <span class="title-ref">DockItem</span>.
>
> ``` xojo
> App.DockItem.Graphics.DrawPicture(MyDockIcon, 0, 0, 128, 128)
> App.DockItem.UpdateNow
> ```

## Notes

The <span class="title-ref">DockItem</span> class is only for macOS. It enables you to manipulate the dock item associated with your application or with the application's windows. To manipulate the application's dock icon, use the <span class="title-ref">DockItem</span> property of the `DesktopApplication</api/user_interface/desktop/desktopapplication>` class. To manipulate a window's dock icon, use the <span class="title-ref">DockItem</span> property of the `Window</api/user_interface/desktop/desktopwindow>` class.

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 at least a 128x128 pixel icon and perhaps as large as 1024x1024 for newer version of macOS.

The <span class="title-ref">DockItem</span> class has two methods, UpdateNow and ResetIcon. ResetIcon resets the icon to its original state. Call the UpdateNow method to redraw the icon. You can also use the `Graphics.ClearRectangle<graphics.clearrectangle>` 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 <span class="title-ref">DockItem</span>'s Graphics property, such as drawing in a picture or using a `Group2D</api/graphics/group2d>`.

The `Graphics</api/graphics/graphics>` property may be `Nil</api/language/nil>`; it is non-`Nil</api/language/nil>` for a window only when a macOS window has been minimized to the dock.

## Compatibility

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

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `DesktopApplication</api/user_interface/desktop/desktopapplication>`, `Graphics</api/graphics/graphics>`, `Window</api/user_interface/desktop/desktopwindow>` classes.

</div>
