Class

# DesktopContainer

<div class="rst-class">

forsearch

</div>

Popover

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

## Description

Used to embed a group of controls in a `Window</api/user_interface/desktop/desktopwindow>` or in another `control</api/user_interface/desktop/desktopuicontrol>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                        | Type                                                             | Read-Only | Shared |
|-------------------------------------------------------------|------------------------------------------------------------------|-----------|--------|
| `AllowAutoDeactivate<desktopcontainer.allowautodeactivate>` | `Boolean</api/data_types/boolean>`                               |           |        |
| `AllowFocus<desktopcontainer.allowfocus>`                   | `Boolean</api/data_types/boolean>`                               |           |        |
| `AllowFocusRing<desktopcontainer.allowfocusring>`           | `Boolean</api/data_types/boolean>`                               |           |        |
| `AllowTabs<desktopcontainer.allowtabs>`                     | `Boolean</api/data_types/boolean>`                               |           |        |
| `Backdrop<desktopcontainer.backdrop>`                       | `Picture</api/graphics/picture>`                                 |           |        |
| `BackgroundColor<desktopcontainer.backgroundcolor>`         | `ColorGroup</api/graphics/colorgroup>`                           |           |        |
| `Bounds<desktopcontainer.bounds>`                           | `Rect</api/graphics/rect>`                                       |           |        |
| `Composited<desktopcontainer.composited>`                   | `Boolean</api/data_types/boolean>`                               |           |        |
| `ControlCount<desktopcontainer.controlcount>`               | `Integer</api/data_types/integer>`                               | ✓         |        |
| `Enabled<desktopcontainer.enabled>`                         | `Boolean</api/data_types/boolean>`                               |           |        |
| `Focus<desktopcontainer.focus>`                             | `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` |           |        |
| `Handle<desktopcontainer.handle>`                           | `Ptr</api/data_types/additional_types/ptr>`                      | ✓         |        |
| `HasBackgroundColor<desktopcontainer.hasbackgroundcolor>`   | `Boolean</api/data_types/boolean>`                               |           |        |
| `Height<desktopcontainer.height>`                           | `Integer</api/data_types/integer>`                               |           |        |
| `LastControlIndex<desktopcontainer.lastcontrolindex>`       | `Integer</api/data_types/integer>`                               |           |        |
| `Left<desktopcontainer.left>`                               | `Integer</api/data_types/integer>`                               |           |        |
| `LockBottom<desktopcontainer.lockbottom>`                   | `Boolean</api/data_types/boolean>`                               |           |        |
| `LockLeft<desktopcontainer.lockleft>`                       | `Boolean</api/data_types/boolean>`                               |           |        |
| `LockRight<desktopcontainer.lockright>`                     | `Boolean</api/data_types/boolean>`                               |           |        |
| `LockTop<desktopcontainer.locktop>`                         | `Boolean</api/data_types/boolean>`                               |           |        |
| `MouseCursor<desktopcontainer.mousecursor>`                 | `MouseCursor</api/user_interface/desktop/mousecursor>`           |           |        |
| `MouseX<desktopcontainer.mousex>`                           | `Integer</api/data_types/integer>`                               | ✓         |        |
| `MouseY<desktopcontainer.mousey>`                           | `Integer</api/data_types/integer>`                               | ✓         |        |
| `PanelIndex<desktopcontainer.panelindex>`                   | `Integer</api/data_types/integer>`                               |           |        |
| `Parent<desktopcontainer.parent>`                           | `Object</api/data_types/additional_types/object>`                | ✓         |        |
| `ScaleFactor<desktopcontainer.scalefactor>`                 | `Double</api/data_types/double>`                                 | ✓         |        |
| `TabIndex<desktopcontainer.tabindex>`                       | `Integer</api/data_types/integer>`                               |           |        |
| `Tooltip<desktopcontainer.tooltip>`                         | `String</api/data_types/string>`                                 |           |        |
| `Top<desktopcontainer.top>`                                 | `Integer</api/data_types/integer>`                               |           |        |
| `Transparent<desktopcontainer.transparent>`                 | `Boolean</api/data_types/boolean>`                               |           |        |
| `Visible<desktopcontainer.visible>`                         | `Boolean</api/data_types/boolean>`                               |           |        |
| `Width<desktopcontainer.width>`                             | `Integer</api/data_types/integer>`                               |           |        |
| `Window<desktopcontainer.window>`                           | `DesktopWindow</api/user_interface/desktop/desktopwindow>`       | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                    | Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Returns                                           | Shared |
|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|--------|
| `AcceptFileDrop<desktopcontainer.acceptfiledrop>`       | FileType As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                   |        |
| `AcceptPictureDrop<desktopcontainer.acceptpicturedrop>` |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `AcceptRawDataDrop<desktopcontainer.acceptrawdatadrop>` | Type As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                   |        |
| `AcceptTextDrop<desktopcontainer.accepttextdrop>`       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `AddControl<desktopcontainer.addcontrol>`               | control As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`                                                                                                                                                                                                                                                                                                                                                                                                          |                                                   |        |
| `BitmapForCaching<desktopcontainer.bitmapforcaching>`   | width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                                                                                                                            | `Picture</api/graphics/picture>`                  |        |
| `Close<desktopcontainer.close>`                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `ControlAt<desktopcontainer.controlat>`                 | index As `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                                                                                                                                                                          | `Object</api/data_types/additional_types/object>` |        |
| `Controls<desktopcontainer.controls>`                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `Iterable</api/language/iterable>`                |        |
| `DrawInto<desktopcontainer.drawinto>`                   | g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                                                                                            |                                                   |        |
| `EmbedWithin<desktopcontainer.embedwithin>`             | containingWindow As `DesktopWindow</api/user_interface/desktop/desktopwindow>`, left As `Integer</api/data_types/integer>` = 0, top As `Integer</api/data_types/integer>` = 0, width As `Integer</api/data_types/integer>` = -1, height As `Integer</api/data_types/integer>` = -1                                                                                                                                                                                                   |                                                   |        |
|                                                         | containingControl As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`, left As `Integer</api/data_types/integer>` = 0, top As `Integer</api/data_types/integer>` = 0, width As `Integer</api/data_types/integer>` = -1, height As `Integer</api/data_types/integer>` = -1                                                                                                                                                                                            |                                                   |        |
| `EmbedWithinPanel<desktopcontainer.embedwithinpanel>`   | containingPanel As `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>`, page As `Integer</api/data_types/integer>`, left As `Integer</api/data_types/integer>` = 0, top As `Integer</api/data_types/integer>` = 0, width As `Integer</api/data_types/integer>` = -1, height As `Integer</api/data_types/integer>` = -1                                                                                                                                                  |                                                   |        |
| `FocusNext<desktopcontainer.focusnext>`                 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `FocusPrevious<desktopcontainer.focusprevious>`         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `Hide<desktopcontainer.hide>`                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `Objects<desktopcontainer.objects>`                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `Iterable</api/language/iterable>`                |        |
| `Refresh<desktopcontainer.refresh>`                     | immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                                                                                                                                                                                                                                                                                     |                                                   |        |
|                                                         | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                                                                                                        |                                                   |        |
| `RemoveControl<desktopcontainer.removecontrol>`         | control As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`                                                                                                                                                                                                                                                                                                                                                                                                          |                                                   |        |
| `SetFocus<desktopcontainer.setfocus>`                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                   |        |
| `ShowPopover<desktopcontainer.showpopover>`             | parentControl As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`, displaySide As `DesktopWindow.DisplaySides<desktopwindow.displaysides>` = `DesktopWindow.DisplaySides<desktopwindow.displaysides>`.Bottom, detachable As `Boolean</api/data_types/boolean>` = `True</api/language/true>`, animated As `Boolean</api/data_types/boolean>` = `True</api/language/true>`, x As `Integer</api/data_types/integer>` = -1, y As `Integer</api/data_types/integer>` = -1 |                                                   |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                                      | Parameters                                                                                                                                                                            | Returns                            |
|---------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `ConstructContextualMenu<desktopcontainer.constructcontextualmenu>`       | Base As `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                              | `Boolean</api/data_types/boolean>` |
| `ContextualMenuItemSelected<desktopcontainer.contextualmenuitemselected>` | HitItem As `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>`                                                                                                             | `Boolean</api/data_types/boolean>` |
| `Closing<desktopcontainer.closing>`                                       |                                                                                                                                                                                       |                                    |
| `DragEnter<desktopcontainer.dragenter>`                                   | Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`                                                                                   | `Boolean</api/data_types/boolean>` |
| `DragExit<desktopcontainer.dragexit>`                                     | Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`                                                                                   |                                    |
| `DragOver<desktopcontainer.dragover>`                                     | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>` | `Boolean</api/data_types/boolean>` |
| `DropObject<desktopcontainer.dropobject>`                                 | Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`                                                                                   |                                    |
| `FocusLost<desktopcontainer.focuslost>`                                   |                                                                                                                                                                                       |                                    |
| `FocusReceived<desktopcontainer.focusreceived>`                           |                                                                                                                                                                                       |                                    |
| `KeyDown<desktopcontainer.keydown>`                                       | Key As `String</api/data_types/string>`                                                                                                                                               | `Boolean</api/data_types/boolean>` |
| `KeyUp<desktopcontainer.keyup>`                                           | Key As `String</api/data_types/string>`                                                                                                                                               |                                    |
| `MenuBarSelected<desktopcontainer.menubarselected>`                       |                                                                                                                                                                                       |                                    |
| `MouseDown<desktopcontainer.mousedown>`                                   | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                                                                                      | `Boolean</api/data_types/boolean>` |
| `MouseDrag<desktopcontainer.mousedrag>`                                   | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                                                                                      |                                    |
| `MouseEnter<desktopcontainer.mouseenter>`                                 |                                                                                                                                                                                       |                                    |
| `MouseExit<desktopcontainer.mouseexit>`                                   |                                                                                                                                                                                       |                                    |
| `MouseMove<desktopcontainer.mousemove>`                                   | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                                                                                      |                                    |
| `MouseUp<desktopcontainer.mouseup>`                                       | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                                                                                      |                                    |
| `MouseWheel<desktopcontainer.mousewheel>`                                 | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`, DeltaX As `Integer</api/data_types/integer>`, DeltaY As `Integer</api/data_types/integer>`          | `Boolean</api/data_types/boolean>` |
| `Opening<desktopcontainer.opening>`                                       |                                                                                                                                                                                       |                                    |
| `Paint<desktopcontainer.paint>`                                           | g As `Graphics</api/graphics/graphics>`, areas() As `Rect</api/graphics/rect>`                                                                                                        |                                    |
| `Resized<desktopcontainer.resized>`                                       |                                                                                                                                                                                       |                                    |
| `Resizing<desktopcontainer.resizing>`                                     |                                                                                                                                                                                       |                                    |
| `ScaleFactorChanged<desktopcontainer.scalefactorchanged>`                 |                                                                                                                                                                                       |                                    |

## Enumerations

<div id="desktopwindow.displaysides">

<div class="rst-class">

forsearch

</div>

</div>

DesktopWindow.DisplaySides

### DisplaySides

> Specifies where the popover will display relative to the control its popping over.
>
> | Enum   | Description                         |
> |--------|-------------------------------------|
> | Bottom | Below the parent control.           |
> | Left   | To the left of the parent control.  |
> | Top    | Above the parent control.           |
> | Right  | To the right of the parent control. |

## Property descriptions

<div id="desktopcontainer.allowautodeactivate">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AllowAutoDeactivate

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

> Determines whether the container should be deactivated (on macOS) when the parent window is deactivated.
>
> This example turns AllowAutoDeactivate off.
>
> ``` xojo
> MyDesktopContainer.AllowAutoDeactivate = False
> ```

<div id="desktopcontainer.allowfocus">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AllowFocus

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

> If `True</api/language/true>`, the container will be included in the Tab order and can accept the focus.
>
> This code enables the AllowFocus property. It is in the Opening event of the container.
>
> ``` xojo
> Me.AllowFocus = True
> ```

<div id="desktopcontainer.allowfocusring">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AllowFocusRing

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

> If `True</api/language/true>`, the Container indicates that it has the focus with a ring around its border; if `False</api/language/false>`, the appearance of the object does not change when it has the focus.

<div id="desktopcontainer.allowtabs">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AllowTabs

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

> If `True</api/language/true>` and `AllowFocus<desktopcontainer.allowfocus>` is `True</api/language/true>`, then pressing Tab triggers the `KeyDown</api/user_interface/desktop/desktopuicontrol>` event for processing.
>
> If AllowTabs is `False</api/language/false>`, pressing the Tab key does not trigger the `KeyDown</api/user_interface/desktop/desktopuicontrol>` event; pressing Tab triggers the `FocusLost<desktopcontainer.focuslost>` event and selects the next object in the `DesktopWindow</api/user_interface/desktop/desktopwindow>` that can accept the focus.

<div id="desktopcontainer.backdrop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Backdrop

**Backdrop** As `Picture</api/graphics/picture>`

> Gets or sets the picture object that will be drawn in the container's background.
>
> You should not assign a new picture to the backdrop of the container when being inside the paint event of that container. This can lead into problems like the backdrop not being painted.
>
> This example sets the backdrop to a jpg image that has been added to the Project. This is in the Opening event.
>
> ``` xojo
> Me.Backdrop = MyPicture
> ```

<div id="desktopcontainer.backgroundcolor">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.BackgroundColor

**BackgroundColor** As `ColorGroup</api/graphics/colorgroup>`

> The background color for the object. The `HasBackgroundColor<desktopcontainer.hasbackgroundcolor>` property, must be set to `True</api/language/true>` to have the BackgroundColor displayed.
>
> This code sets the `HasBackgroundColor<desktopcontainer.hasbackgroundcolor>` property and sets the value of the BackgroundColor property:
>
> ``` xojo
> Me.HasBackgroundColor = True
> Me.BackgroundColor = &c110034
> ```

<div id="desktopcontainer.bounds">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Bounds

**Bounds** As `Rect</api/graphics/rect>`

> Use this property to Get/Set the true bounds of a container.
>
> To get the bounds:
>
> ``` xojo
> Var containerBounds As Rect
> containerBounds = Self.Bounds
> MessageBox("Left = " + containerBounds.Left.ToString)
> ```
>
> To set the bounds, do not modify the Bounds properly directly. This does not work because you will be modifying a temporary object. Instead set the bounds in your own `Rect</api/graphics/rect>` instance and assign that to bounds:
>
> ``` xojo
> Var myBounds As New Rect
> myBounds.Left = 100
> myBounds.Top = 100
> myBounds.Height = Self.Height
> myBounds.Width = Self.Width
> Self.Bounds = myBounds
> ```

<div id="desktopcontainer.composited">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Composited

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

> When `True</api/language/true>`, reduces flickering on Windows when the <span class="title-ref">DesktopContainer</span> is scrolled. Has no effect on macOS or Linux.

<div id="desktopcontainer.controlcount">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ControlCount

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

> The number of controls in the container.
>
> This property is read-only.
>
> The following example is in the Pressed event of a `DesktopButton</api/user_interface/desktop/desktopbutton>`. It displays the number of controls in the container:
>
> ``` xojo
> MessageBox(Self.ControlCount.ToString)
> ```

<div id="desktopcontainer.enabled">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Enabled

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

> Determines if the <span class="title-ref">DesktopContainer</span> should be enabled when the owning window is opened. The default is `True</api/language/true>`.
>
> The following example disables the <span class="title-ref">DesktopContainer</span>.
>
> ``` xojo
> MyDesktopContainer.Enabled=False
> ```

<div id="desktopcontainer.focus">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Focus

**Focus** As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`

> Gets or sets the `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` in the container that has the focus. If no control has the focus, this property is `Nil</api/language/nil>`.
>
> The following example reports on the control in the <span class="title-ref">DesktopContainer</span> that has the focus.
>
> ``` xojo
> MessageBox(ContainerControl11.Focus.Name)
> ```

<div id="desktopcontainer.handle">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> Returns a handle to the container.
>
> This property is read-only.
>
> When interfacing with Cocoa APIs using `Declares</api/language/declare>` Container.Handle always gives a NSWindow or NSPanel.

<div id="desktopcontainer.hasbackgroundcolor">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.HasBackgroundColor

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

> If `True</api/language/true>`, the background color of the container is set to the value of the `BackgroundColor<desktopcontainer.backgroundcolor>` property.
>
> This property must be set in order for the value of the `BackgroundColor<desktopcontainer.backgroundcolor>` property to be applied to the container.
>
> This example sets the HasBackgroundColor property and sets the value of the BackgroundColor property.
>
> ``` xojo
> Me.HasBackgroundColor = True
> Me.BackgroundColor = &c110034
> ```

<div id="desktopcontainer.height">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Height

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

> The height (in points) of the control.
>
> This example sets the height of the control to 100:
>
> ``` xojo
> Me.Height = 100
> ```

<div id="desktopcontainer.lastcontrolindex">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.LastControlIndex

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

> The index of the last `DesktopControl</api/user_interface/desktop/desktopcontrol>` on the <span class="title-ref">DesktopContainer</span>.

<div id="desktopcontainer.left">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Left

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

> The distance (in points) between the left edge of the parent `container <desktopcontainer.parent>` or `window<desktopcontainer.window>` and the left edge of the content area of the container.
>
> ``` xojo
> Me.Left = 50
> ```

<div id="desktopcontainer.lockbottom">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.LockBottom

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

> Determines whether the bottom edge of the <span class="title-ref">DesktopContainer</span> should stay at a set distance from the bottom edge of the parent `control</api/user_interface/desktop/desktopuicontrol>`, if there is one, or the owning `DesktopWindow</api/user_interface/desktop/desktopwindow>`.
>
> ``` xojo
> Me.LockBottom = True
> ```

<div id="desktopcontainer.lockleft">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.LockLeft

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

> ether the left edge of the <span class="title-ref">DesktopContainer</span> should stay at a set distance from the left edge of the parent `control</api/user_interface/desktop/desktopuicontrol>`, if there is one, or the owning `DesktopWindow</api/user_interface/desktop/desktopwindow>`.

<div id="desktopcontainer.lockright">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.LockRight

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

> Determines whether the right edge of the <span class="title-ref">DesktopContainer</span> should stay at a set distance from the right edge of the parent `control</api/user_interface/desktop/desktopuicontrol>`, if there is one, or the owning `DesktopWindow</api/user_interface/desktop/desktopwindow>`.
>
> ``` xojo
> Me.LockRight = True
> ```

<div id="desktopcontainer.locktop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.LockTop

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

> Determines whether the top edge of the <span class="title-ref">DesktopContainer</span> should stay at a set distance from the top edge of the parent `control</api/user_interface/desktop/desktopuicontrol>`, if there is one, or the owning `DesktopWindow</api/user_interface/desktop/desktopwindow>`.
>
> ``` xojo
> Me.LockTop = True
> ```

<div id="desktopcontainer.mousecursor">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseCursor

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

> The cursor to be displayed while the mouse is within the container and the `DesktopApplication</api/user_interface/desktop/desktopapplication>` class's MouseCursor property is `Nil</api/language/nil>`.
>
> If the `DesktopApplication</api/user_interface/desktop/desktopapplication>` class MouseCursor is not `Nil</api/language/nil>`, non-Nil MouseCursors belonging to any windows, containers or `Controls</api/user_interface/desktop/desktopcontrol>` are ignored. If the container's MouseCursor property is not `Nil</api/language/nil>`, the MouseCursor properties of any `Controls</api/user_interface/desktop/desktopcontrol>` are ignored. You can use the cursors in the `Cursors</api/user_interface/desktop/cursors>` module to set the MouseCursor for the container.
>
> This line sets the default cursor to the finger pointer.
>
> ``` xojo
> Me.MouseCursor = System.Cursors.FingerPointer
> ```

<div id="desktopcontainer.mousex">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseX

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

> The X coordinate of the mouse (points). Measured from the top-left corner of the container.
>
> This property is read-only.

<div id="desktopcontainer.mousey">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseY

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

> The Y coordinate of the mouse (points). Measured from the top-left corner of the container.
>
> This property is read-only.

<div id="desktopcontainer.panelindex">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.PanelIndex

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

> If the container has been placed on a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>` or `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` control, this is the panel (page/tab) that the container is on.
>
> The first panel is numbered zero. If the container has been placed on a panel of a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>` or `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` control, it returns the panel number. If the container is not on a `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` or `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>`, it returns -1. If you change the PanelIndex to a nonexistent panel, the control will disappear until you give it a PanelIndex value that corresponds to a panel that exists.
>
> If you are looking to change the currently selected panel (page/tab), use `DesktopPagePanel<desktoppagepanel.selectedpanelindex>`.
>
> This code (in the container's Opening event) displays the panel index of the container:
>
> ``` xojo
> MessageBox(Me.PanelIndex.ToString)
> ```

<div id="desktopcontainer.parent">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Parent

**Parent** As `Object</api/data_types/additional_types/object>`

> The containing control, if any.
>
> This property is read-only.

<div id="desktopcontainer.scalefactor">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ScaleFactor

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

> The scale factor used when converting user space coordinates to backing store coordinates for this container.
>
> This property is read-only.

<div id="desktopcontainer.tabindex">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.TabIndex

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

> The **DesktopContainer's** position in the Tab Order.
>
> On macOS, only controls controls where you enter data from the keyboard typically get the focus. In order to manually set focus to controls that don't allow keyboard entry, go to System Preferences, click on the Keyboard icon then on the Shortcuts tab and then check the *Use keyboard navigation to move focus between controls* checkbox.
>
> This example sets the Container's TabIndex.
>
> ``` xojo
> Me.TabIndex = 2
> ```

<div id="desktopcontainer.tooltip">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Tooltip

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

> Text of help message displayed as a Windows or Linux "tip" or macOS help tag.
>
> ``` xojo
> Me.Tooltip = "This is a tooltip."
> ```

<div id="desktopcontainer.top">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Top

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

> The distance (in pixels) between the top edge of the screen and the top edge of the content region of the parent `window<desktopcontainer.window>` or container.
>
> Setting Top = 0 moves the top of the container's content area to the top of the parent window or container.

<div id="desktopcontainer.transparent">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Transparent

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

> If `True</api/language/true>`, the background shows through to the <span class="title-ref">DesktopContainer</span>; if `False</api/language/false>`, the <span class="title-ref">DesktopContainer</span> is opaque. The default is `True</api/language/true>`.
>
> <span class="title-ref">DesktopContainers</span> by default are transparent controls, which means the background shows through. The Transparent property can be set (at design time or runtime) to turn this off/on as needed. An opaque <span class="title-ref">DesktopContainer</span> flickers less on Windows, is more optimized on macOS, and on Linux child controls on <span class="title-ref">DesktopContainer</span> are clipped properly.
>
> This example turns Transparent off:
>
> ``` xojo
> Me.Transparent = False
> ```

<div id="desktopcontainer.visible">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Visible

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

> Determines whether the control is visible when its owning window is opened. The default is `True</api/language/true>`: the control is visible.
>
> The following code makes the control invisible:
>
> ``` xojo
> Me.Visible = False
> ```

<div id="desktopcontainer.width">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Width

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

> The width (in points) of the control.
>
> The following example resizes the control:
>
> ``` xojo
> Me.Width = 200
> ```

<div id="desktopcontainer.window">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Window

**Window** As `DesktopWindow</api/user_interface/desktop/desktopwindow>`

> Returns a reference to the actual enclosing window.
>
> This property is read-only.
>
> Window walks up the window hierarchy and finds the actual enclosing window regardless of how deeply nested the `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` or <span class="title-ref">DesktopContainer</span> hierarchy is.
>
> `DesktopControl</api/user_interface/desktop/desktopcontrol>` also has a Window property.

## Method descriptions

<div id="desktopcontainer.acceptfiledrop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AcceptFileDrop

**AcceptFileDrop**(FileType As `String</api/data_types/string>`)

> Permits documents of type *FileType* to be dropped on the container.
>
> *FileType* must be a file type you specified via the `FileType</api/files/filetype>` class or the File Type Sets Editor. It works correctly even if you have multiple file types defined with the same File type code, and you don't specifically call AcceptFileDrop for the first such type.

<div id="desktopcontainer.acceptpicturedrop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AcceptPictureDrop

**AcceptPictureDrop**

> Permits pictures to be dropped on the container.

<div id="desktopcontainer.acceptrawdatadrop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AcceptRawDataDrop

**AcceptRawDataDrop**(Type As `String</api/data_types/string>`)

> Permits data (of the type specified) to be dropped on the container. *Type* is a four-character resource code, e.g., 'snd ' or 'TEXT', or a UTI such as 'public.data' or 'public.jpeg'.

<div id="desktopcontainer.accepttextdrop">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AcceptTextDrop

**AcceptTextDrop**

> Permits text to be dropped on the container.

<div id="desktopcontainer.addcontrol">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.AddControl

**AddControl**(control As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`)

> Adds the control passed to the layout.
>
> <div class="warning">
>
> <div class="title">
>
> Warning
>
> </div>
>
> Controls created dynamically (to be added to the container) will not have the default values controls are given when created in the Layout Editor. You will need to supply all default values. For example, with a `DesktopListBox</api/user_interface/desktop/desktoplistbox>`, if your code doesn't specify the `DefaultRowHeight<desktoplistbox.defaultrowheight>`, it will be zero, which means the rows will not appear.
>
> </div>

<div id="desktopcontainer.bitmapforcaching">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.BitmapForCaching

**BitmapForCaching**(width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`) As `Picture</api/graphics/picture>`

> Returns a bitmap that is configured correctly for using as a cache for content to be drawn to this container. This image supports Alpha Channels (not masked images).
>
> Use this method instead of "New Picture" in order to get a Picture image that is suitable for HiDPI displays.
>
> Raises exceptions in the following cases:
>
> - InvalidArgumentException if width, height, or scale are less than or equal to zero
> - OutOfMemoryException if the picture could not be allocated
>
> If you need to support images with masks AND images that use alpha channels code like the following will let you handle both cases for HiDPI displays
>
> ``` xojo
> Public Function BitmapForCaching(Extends g As Graphics, width As Integer = -1, height As Integer = -1, withMask As Boolean = False) As Picture
>   #Pragma BackgroundTasks False
>   If width = -1 Then width = g.Width
>   If height = -1 Then height = g.Height
>
>   If width <= 0 Then width = 1
>   If height <= 0 Then height = 1
>
>   #If TargetLinux Then
>     If withMask Then
>       Return New Picture(width, height, 32)
>     Else
>       Return New Picture(width, height)
>     End If
>   #Else
>     Var pic As Picture
>     If withMask Then
>       pic = New Picture(width * g.ScaleX, height * g.ScaleY, 32)
>     Else
>       pic = New Picture(width * g.ScaleX, height * g.ScaleY)
>     End If
>     ' Set the resolutions
>     pic.HorizontalResolution = 72 * g.ScaleX
>     pic.VerticalResolution = 72 * g.ScaleY
>
>     ' Make sure the two graphics object scales match the reference graphics object
>     Var gScaleX As Double = g.ScaleX
>     Var gScaleY As Double = g.ScaleY
>     pic.Graphics.ScaleX = gScaleX
>     pic.Graphics.ScaleY = gScaleY
>     If withMask Then
>       pic.Mask.Graphics.ScaleX = gScaleX
>       pic.Mask.Graphics.ScaleY = gScaleY
>     End If
>     Return pic
>   #EndIf
> End Function
> ```

<div id="desktopcontainer.close">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Close

**Close**

> Closes the container. Once closed, a container cannot be refreshed or redrawn. Calling Close triggers the CancelClosing event.

<div id="desktopcontainer.controlat">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ControlAt

**ControlAt**(index As `Integer</api/data_types/integer>`) As `Object</api/data_types/additional_types/object>`

> The zero-based way to lookup controls in the container.
>
> All controls on the container are returned as an `Object</api/data_types/additional_types/object>` base type. You can use the IsA operator to check the specific type to see if the control is a DesktopButton, DesktopLabel, etc.
>
> This example is in the Pressed event of a `DesktopButton</api/user_interface/desktop/desktopbutton>` and displays the name of the first control in container:
>
> ``` xojo
> MessageBox(Self.ControlAt(0).Name)
> ```
>
> Loop through all the controls on a container and disable only the TextFields:
>
> ``` xojo
> Var c As Object
> For i As Integer = 0 To Self.ControlCount - 1
>   c = Self.ControlAt(i)
>   If c IsA DesktopTextField Then
>     DesktopTextField(c).Enabled = False
>   End If
> Next
> ```

<div id="desktopcontainer.controls">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Controls

**Controls** As `Iterable</api/language/iterable>`

> Used to iterate through the controls on a container.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This does not include non-control object instances. For that, use the `Objects<desktopcontainer.objects>` method.
>
> </div>
>
> All controls on the container are returned as a the `DesktopControl</api/user_interface/desktop/desktopcontrol>` base type. You can use the IsA operator to check the specific type to see if the control is a button, label, etc.
>
> Loop through all the controls on a container and disable only the textfields:
>
> ``` xojo
> For Each c As Object In Self.Controls
>   If c IsA DesktopTextField Then
>     DesktopTextField(c).Enabled = False
>   End If
> Next
> ```

<div id="desktopcontainer.drawinto">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.DrawInto

**DrawInto**(g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> DrawInto will only work if the container is on a window.
>
> </div>
>
> Draws the contents of the container into the specified `Graphics</api/graphics/graphics>` context.

<div id="desktopcontainer.embedwithin">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.EmbedWithin

**EmbedWithin**(containingWindow As `DesktopWindow</api/user_interface/desktop/desktopwindow>`, left As `Integer</api/data_types/integer>` = 0, top As `Integer</api/data_types/integer>` = 0, width As `Integer</api/data_types/integer>` = -1, height As `Integer</api/data_types/integer>` = -1)

> Embeds the <span class="title-ref">DesktopContainer</span> in the specified DesktopWindow.

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

<div class="rst-class">

forsearch

</div>

DesktopContainer.EmbedWithin

**EmbedWithin**(containingControl As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`, left As `Integer</api/data_types/integer>` = 0, top As `Integer</api/data_types/integer>` = 0, width As `Integer</api/data_types/integer>` = -1, height As `Integer</api/data_types/integer>` = -1)

> Embeds the <span class="title-ref">DesktopContainer</span> in the specified DesktopUIControl.
>
> This code is in the Pressed event of a button and add a <span class="title-ref">DesktopContainer</span> to a window:
>
> ``` xojo
> Var tc As New TestContainer
> tc.EmbedWithin(Self, 10, 100, 300, 400)
> ```
>
> If you need to later remove the container, then you'll need to have a reference to it. In this case, use a property for the container. Add the container using EmbedWithin and remove it using Close.
>
> ``` xojo
> ' Add the container
> MyContainer = New TestContainer
> MyContainer.EmbedWithin(Self, 10, 100, 300, 400)
> ```
>
> Elsewhere you can remove the container:
>
> ``` xojo
> MyContainer.Close
> ```

<div id="desktopcontainer.embedwithinpanel">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.EmbedWithinPanel

**EmbedWithinPanel**(containingPanel As `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>`, page As `Integer</api/data_types/integer>`, left As `Integer</api/data_types/integer>` = 0, top As `Integer</api/data_types/integer>` = 0, width As `Integer</api/data_types/integer>` = -1, height As `Integer</api/data_types/integer>` = -1)

> Embeds the <span class="title-ref">DesktopContainer</span> on a page in the passed `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` or `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>`.
>
> An instance of a <span class="title-ref">DesktopContainer</span> can only be embedded into one page.
>
> The <span class="title-ref">DesktopContainer</span> is embedded on the passed page and the containing control is the parent of the <span class="title-ref">DesktopContainer</span>. The optional *Left* and *Top* parameters determine the location of the top-left corner, relative to the containing control, not the parent window. If the <span class="title-ref">DesktopContainer</span> itself has Left and Top values (not typical as they default to 0) then they are added to what is specified here. The optional parameters *Width* and *Height* determine the size of the <span class="title-ref">DesktopContainer</span>.
>
> This example adds a new tab to a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>` and then add a <span class="title-ref">DesktopContainer</span> to it:
>
> ``` xojo
> MainTab.AddPanel("New Tab")
> Var tabNum As Integer
> tabNum = MainTab.PanelCount - 1
>
> Var cc As New MyContainer
> cc.EmbedWithinPanel(MainTab, tabNum)
> ```

<div id="desktopcontainer.focusnext">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.FocusNext

**FocusNext**

> Changes the focus to the next control in the Tab Order.

<div id="desktopcontainer.focusprevious">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.FocusPrevious

**FocusPrevious**

> Changes the focus to the previous control in the Tab Order.

<div id="desktopcontainer.hide">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Hide

**Hide**

> Makes the container invisible.

<div id="desktopcontainer.objects">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Objects

**Objects** As `Iterable</api/language/iterable>`

> Allows you to iterate through all the non-control object instances on the container.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This does not include controls. For that, use the `Controls<desktopcontainer.controls>` method.
>
> </div>

<div id="desktopcontainer.refresh">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Refresh

**Refresh**(immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Redraws the portion specified of the contents of the control the next time the OS redraws the control or immediately if `True</api/language/true>` is passed.
>
> If you are calling this so frequently that you experience a slowdown in your code, pass `True</api/language/true>` for the immediately parameter.
>
> Calling this method causes the Render event to fire.
>
> Refresh the entire area immediately:
>
> ``` xojo
> Me.Refresh(True)
> ```
>
> Refresh a portion of the area the next time the OS redraws the control:
>
> ``` xojo
> Me.Refresh(100, 150, 200, 300)
> ```

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

**Refresh**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, immediately As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Redraws the area passed the next time the OS redraws the container or immediately if `True</api/language/true>` is passed.

<div id="desktopcontainer.removecontrol">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.RemoveControl

**RemoveControl**(control As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`)

> Removes the *control* from the <span class="title-ref">DesktopContainer</span>.

<div id="desktopcontainer.setfocus">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.SetFocus

**SetFocus**

> Sets the focus to the container, leaving no control with the focus.
>
> Use the SetFocus method of the `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` class to set the focus to a particular control in the window.

<div id="desktopcontainer.showpopover">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ShowPopover

**ShowPopover**(parentControl As `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`, displaySide As `DesktopWindow.DisplaySides<desktopwindow.displaysides>` = `DesktopWindow.DisplaySides<desktopwindow.displaysides>`.Bottom, detachable As `Boolean</api/data_types/boolean>` = `True</api/language/true>`, animated As `Boolean</api/data_types/boolean>` = `True</api/language/true>`, x As `Integer</api/data_types/integer>` = -1, y As `Integer</api/data_types/integer>` = -1)

> Displays the container as a popover next to the *parentControl* based upon the parameters passed. When provided, the optional *x* and *y* values passed display the popover at that offset relative to the upper-left corner of the parent control.
>
> The *animated* parameter is supported for Linux and macOS only.
>
> This example from a `button's Pressed</api/user_interface/desktop/desktopbutton>` event displays the container named *MyPopover* below (the default) the button:
>
> ``` xojo
> Var c As New MyPopover
> c.ShowPopover(Me)
> ```
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> The ability to detach a popover is only supported on macOS.
>
> </div>
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> Behind the scenes, a popover is a window. Therefore once the user clicks away from it, the popover is closed by the OS and thus window used is `Nil</api/language/nil>`.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> On Linux, popovers require GTK 3.22 or later.
>
> </div>

## Event descriptions

<div id="desktopcontainer.constructcontextualmenu">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ConstructContextualMenu

**ConstructContextualMenu**(Base As `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

> Fires whenever it is appropriate to display a contextual menu for the container.
>
> This is the recommended way to handle contextual menus because this event figures out whether the user has requested the contextual menu, regardless of how he did it. Returns a `Boolean</api/data_types/boolean>`. *Base* is analogous to the menu bar for the contextual menu. Any items you add to *Base* will be shown as menu items. If you return `False</api/language/false>`, the event is passed up the parent hierarchy. If you return `True</api/language/true>`, the contextual menu is displayed. The parameters *x* and *y* are the mouse locations. If the event was fired because of a non-mouse event, then *x* and *y* are both set to -1. See the example of a contextual menu in the examples for the `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` class.
>
> The following ConstructContextualMenu event handler builds a menu with three menu items plus a submenu with three additional menu items.
>
> ``` xojo
> ' Add some items
> base.Add(New DesktopMenuItem("Test 1" )
> base.Add(New DesktopMenuItem("Test 2"))
> base.Add(New DesktopMenuItem("Test 3"))
>
> ' Add a Separator
> base.Add(New DesktopMenuItem(MenuItem.TextSeparator))
>
> ' Add a sub menu
> Var submenu As New DesktopMenuItem("SubMenu")
> submenu.Add(New DesktopMenuItem("SubMenu Test 1"))
> submenu.Add(New DesktopMenuItem("SubMenu Test 2"))
> submenu.Add(New DesktopMenuItem("SubMenu Test 3"))
> base.Add(submenu)
>
> ' Add a Separator
> base.Add(New DesktopMenuItem(MenuItem.TextSeparator))
>
> ' Add an item that's on a menu bar so that you can see you don't
> ' have to handle every item returned.
> base.Add(UntitledItem)
>
> #If TargetMacOS Then
>   ' because of how quitting the app is handled on macOS you cannot add the FileQuit item on macOS
> #Else
>   base.Add(FileQuit)
> #EndIf
>
> Return True
> ```

<div id="desktopcontainer.contextualmenuitemselected">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ContextualMenuItemSelected

**ContextualMenuItemSelected**(HitItem As `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>`) As `Boolean</api/data_types/boolean>`

> Fires when a contextual `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>` *HitItem* was selected but the `MenuItemSelected<desktopmenuitem.menuitemselected>` event and the MenuHandler for the `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>` did not handle the menu selection.
>
> This event gives you a chance to handle the menu selection by inspecting the menuitem's `Value</api/user_interface/desktop/desktopmenuitem>` or `Tag<desktopmenuitem.tag>` properties to see which item was selected. Use this in conjunction with `ConstructContextualMenu<desktopcontainer.constructcontextualmenu>` if you have not specified the `MenuItemSelected<desktopmenuitem.menuitemselected>` event or the Menu Handler for the items on the contextual menu.
>
> The following code in a ConstructContextualMenu event builds a simple contextual menu. The parameter *Base* as `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>` is passed in as a parameter.
>
> ``` xojo
> base.Add(New DesktopMenuItem("Import"))
> base.Add(New DesktopMenuItem("Export"))
> Return True  ' display the contextual menu
> ```
>
> The following `Select Case</api/language/select_case>` statement in the ContextualMenuItemSelected event handler inspects the selected menu item, which is passed in as the *HitItem* as `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>` parameter.
>
> ``` xojo
> Select Case HitItem.Text
> Case "Import"
>   MessageBox("You chose Import")
> Case "Export"
>   MessageBox("You chose export")
> End Select
>
> Return True
> ```

<div id="desktopcontainer.closing">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Closing

**Closing**

> The container is about to close. You cannot cancel the closing at this time.

<div id="desktopcontainer.dragenter">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.DragEnter

**DragEnter**(Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`) As `Boolean</api/data_types/boolean>`

> Fired when the `DragItem</api/user_interface/desktop/dragitem>` enters the container. Return `True</api/language/true>` from this event to prevent the drop from occurring.
>
> The *Action* parameter specifies the type drag action (default, copy, move or link).

<div id="desktopcontainer.dragexit">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.DragExit

**DragExit**(Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`)

> Fires when the `DragItem</api/user_interface/desktop/dragitem>` exits the container.
>
> The *Action* parameter specifies the type of drag action (default, copy, move or link).

<div id="desktopcontainer.dragover">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.DragOver

**DragOver**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`) As `Boolean</api/data_types/boolean>`

> Fires when the `DragItem</api/user_interface/desktop/dragitem>` is over the container.
>
> The coordinates *x* and *y* are relative to the **Container**. Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` from this event to prevent the drop from occurring.
>
> The *Action* parameter specifies the type of drag action (default, copy, move or link).

<div id="desktopcontainer.dropobject">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.DropObject

**DropObject**(Obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `DragItem.Types<dragitem.types>`)

> The item represented by *Obj* has been dropped on the container.
>
> The *Action* parameter specifies the type of drag action (default, copy, move or link).

<div id="desktopcontainer.focuslost">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.FocusLost

**FocusLost**

> Called when the <span class="title-ref">DesktopContainer</span> has lost the focus.
>
> The AllowFocus property must be set to `True</api/language/true>` in order for this event to be called.

<div id="desktopcontainer.focusreceived">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.FocusReceived

**FocusReceived**

> Called when the <span class="title-ref">DesktopContainer</span> gets focus.
>
> The AllowFocus property must be set to `True</api/language/true>` in order for this event to be called.

<div id="desktopcontainer.keydown">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.KeyDown

**KeyDown**(Key As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> The passed *Key* has been pressed and not handled by an object in the container. For example, The tab key is never sent to any control. It is instead handled by the container itself. If the container has no controls that can receive the focus, any keys that are pressed will generate KeyDown events for the window or parent container. This event handler is passed a parameter that tells you which key was pressed. Returns a `Boolean</api/data_types/boolean>`. Returning `True</api/language/true>` means that no further processing is to be done with the Key, although the KeyUp event is still called.
>
> The following example scrolls a picture. The picture has been added to the project. The properties *XScroll* and *YScroll* have been added to the container to hold the amounts the picture has been scrolled.
>
> A convenient way to scroll a picture is with the four arrow keys. To do this, you place code in the KeyDown event handler of the container. This event receives each keystroke. Your code can test whether any of the arrow keys have been pressed and then take the appropriate action. For example, this code in the KeyDown event of the container scrolls the picture 8 pixels at a time:
>
> ``` xojo
> Select Case Key.Asc
> Case 31 ' down arrow
>   YScroll = YScroll - 8
>   Canvas1.Scroll(0, -8)
>   Return True
> Case 29 ' Right arrow
>   XScroll = XScroll - 8
>   Canvas1.Scroll(-8, 0)
>   Return True
> Case 30 ' up arrow
>   YScroll = YScroll + 8
>   Canvas1.Scroll(0, 8)
>   Return True
> Case 28 ' Left arrow
>   XScroll = XScroll + 8
>   Canvas1.Scroll(8, 0)
>   Return True
> End Select
> ```
>
> The Paint event of the Canvas has the line of code that draws the picture:
>
> ``` xojo
> g.DrawPicture(MyPicture, XScroll, YScroll)
> ```

<div id="desktopcontainer.keyup">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.KeyUp

**KeyUp**(Key As `String</api/data_types/string>`)

> Fires when the passed *Key* is released and no other object on the container has captured the event. It is not guaranteed to be the same key that received the `KeyDown<desktopcontainer.keydown>` event.

<div id="desktopcontainer.menubarselected">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MenuBarSelected

**MenuBarSelected**

> The user has clicked in the menu bar or pressed a keyboard shortcut assigned to one of the menu items.
>
> Use this event handler to determine whether conditions are right to enable the menu items.

<div id="desktopcontainer.mousedown">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseDown

**MouseDown**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

> The mouse button has been pressed inside the container at the *x*, *y* local coordinates passed. `Return</api/language/return>` `True</api/language/true>` if you are going to handle the mouseDown.

<div id="desktopcontainer.mousedrag">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseDrag

**MouseDrag**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`)

> The mouse button was pressed inside the container and moved (dragged) at the location local to the container passed in to *x*, *y*. The user has moved the mouse inside the container (but not over a control) while the mouse button is held down. This event handler receives parameters that indicate where the mouse is in local container coordinates. This event will not occur unless you return `True</api/language/true>` in the MouseDown event.

<div id="desktopcontainer.mouseenter">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseEnter

**MouseEnter**

> The user has moved the mouse inside the container from a location outside the container.

<div id="desktopcontainer.mouseexit">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseExit

**MouseExit**

> The user has moved the mouse outside the container from a location inside the container.

<div id="desktopcontainer.mousemove">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseMove

**MouseMove**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`)

> The user has moved the mouse inside the container.
>
> This event handler receives parameters that indicate where the mouse is in local container coordinates. The mouse has moved within the container to the *x*, *y* local coordinates passed.

<div id="desktopcontainer.mouseup">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseUp

**MouseUp**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`)

> The mouse button has been released. This event will not occur unless you return `True</api/language/true>` in the MouseDown event handler. The idea behind this is that if the mouse was never down, it can't be up. This event handler receives parameters *x* and *y* that indicate where the mouse was released in local container coordinates.

<div id="desktopcontainer.mousewheel">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.MouseWheel

**MouseWheel**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`, DeltaX As `Integer</api/data_types/integer>`, DeltaY As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

> The mouse wheel has been moved.
>
> The parameters *X* and *Y* are the mouse coordinates relative to the control that has received the event. The parameters *DeltaX* and *DeltaY* hold the number of scroll lines the wheel has been moved horizontally and vertically, as defined by the operating system. *DeltaX* is positive when the user scrolls right and negative when scrolling to the left. *DeltaY* is positive when the user scrolls down and negative when scrolling up. Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` to prevent the event from propagating further.

<div id="desktopcontainer.opening">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Opening

**Opening**

> The container is opening but hasn't been displayed yet. Controls also receive Opening events. A container receives its Opening event after all of the controls have received their Opening events.
>
> You should use the Opening event instead of the Constructor for initialization.

<div id="desktopcontainer.paint">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Paint

**Paint**(g As `Graphics</api/graphics/graphics>`, areas() As `Rect</api/graphics/rect>`)

> Some portion of the container needs to be redrawn either because the container is opening or it has been exposed when a window in front of it was moved or closed. This event handler receives a `Graphics</api/graphics/graphics>` object as a parameter that represents the graphics that will be drawn in the container. `Graphics</api/graphics/graphics>` objects have their own methods for drawing graphics.

<div id="desktopcontainer.resized">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Resized

**Resized**

> The container has been resized by the user or by code that changes the container's Width or Height properties.

<div id="desktopcontainer.resizing">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.Resizing

**Resizing**

> The user is in the process of resizing the container.

<div id="desktopcontainer.scalefactorchanged">

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

</div>

<div class="rst-class">

forsearch

</div>

DesktopContainer.ScaleFactorChanged

**ScaleFactorChanged**

> The backing store scale factor has changed for this container and the application should invalidate any cached bitmaps or other relevant state.

## Notes

<div class="warning">

<div class="title">

Warning

</div>

In the Layout Editor, do not layer other controls onto Containers that have been added to a Window layout. Controls added this way are not part of the Container and will not display properly. Instead, add your controls directly to the Container in its layout.

</div>

While <span class="title-ref">DesktopContainer</span> is a subclass of `DesktopWindow</api/user_interface/desktop/desktopwindow>`, it should be thought of as a hybrid between `DesktopWindow</api/user_interface/desktop/desktopwindow>` and `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`. Like a `DesktopWindow</api/user_interface/desktop/desktopwindow>`, a <span class="title-ref">DesktopContainer</span> can encapsulate related `Controls</api/user_interface/desktop/desktopuicontrol>` (and other <span class="title-ref">DesktopContainers</span>) in a self-contained, reusable class. Like a `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>`, a <span class="title-ref">DesktopContainer</span> can be added to a `DesktopWindow</api/user_interface/desktop/desktopwindow>`, a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>`, a `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>`, or to another <span class="title-ref">DesktopContainer</span>.

You can embed a <span class="title-ref">DesktopContainer</span> in a `DesktopWindow</api/user_interface/desktop/desktopwindow>` or <span class="title-ref">DesktopContainer</span> in either the IDE or via code. Multiple levels of embedding are supported.

To add the <span class="title-ref">DesktopContainer</span> to a window via code, use either the EmbedWithin or EmbedWithinPanel methods. Use EmbedWithin to embed the <span class="title-ref">DesktopContainer</span> in either a window or a control, depending on whether the first parameter is a `DesktopWindow</api/user_interface/desktop/desktopwindow>` or a `control</api/user_interface/desktop/desktopuicontrol>`. For the special case of embedding within a `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` or a `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>`, use EmbedWithinPanel instead. It allows you to pass the page number on which the <span class="title-ref">DesktopContainer</span> will be embedded. To remove the container, use the Close method.

The following statement embeds a <span class="title-ref">DesktopContainer</span> at so that its top left corner is 50 points from the left side of the window and 100 points from the top.

``` xojo
Container1.EmbedWithin(Self, 50, 100)
```

When the project is run, the controls in the <span class="title-ref">DesktopContainer</span> appear in the default window, Window1. Use the same approach to embed the <span class="title-ref">DesktopContainer</span> in a control other than a `DesktopPagePanel</api/user_interface/desktop/desktoppagepanel>` or `DesktopTabPanel</api/user_interface/desktop/desktoptabpanel>`; for the latter types of controls, use EmbedWithinPanel and pass the name of the control and the desired panel number.

DesktopContainers have multiple uses, You can:

- Organize groups of controls into reusable interface components
- Create custom controls made up of several constituent controls
- Increase encapsulation of complex window layouts
- Create dynamic layouts

For the most part, <span class="title-ref">DesktopContainers</span> act as you would expect. For example, if you put code in the MouseMove event of an embedded <span class="title-ref">DesktopContainer</span>, the event will fire when your mouse moves over the embedded <span class="title-ref">DesktopContainer</span>'s boundaries. There are a few things you need to be aware of:

The Handle property of a <span class="title-ref">DesktopContainer</span> and the Handle property of controls of an <span class="title-ref">DesktopContainer</span> are `Nil</api/language/nil>` until the Opening event. All of the other properties can be manipulated before the Opening event.

A <span class="title-ref">DesktopContainer</span> either has its own keyboard focus and menu handling, or it shares these elements with its containing `DesktopWindow</api/user_interface/desktop/desktopwindow>`. Which behavior is chosen depends on the state of the AllowFocus flag when the <span class="title-ref">DesktopContainer</span> is embedded. When AllowFocus is `True</api/language/true>`, the <span class="title-ref">DesktopContainer</span> does not share focus with the containing `DesktopWindow</api/user_interface/desktop/desktopwindow>`. If a containing window has embedded that which share focus with it, those windows will get a first crack at handling it. If none handle it, the containing window will get a try. This applies to KeyDown and MenuCommands. It also affects how menu commands are enabled.

Some properties are new to <span class="title-ref">DesktopContainers</span> and relate to its behavior when embedded; these behave like the corresponding properties of the `DesktopCanvas</api/user_interface/desktop/desktopcanvas>` control. These include the following: LockLeft, LockTop, LockRight, LockBottom, Enabled, AutoDeactivate, HelpTag, UseFocusRing, AllowFocus, AllowTabs, Parent and Window.

<div class="note">

<div class="title">

Note

</div>

At compile time, for historical reasons an underscore (\_) is added to the name of any <span class="title-ref">DesktopContainer</span> instance. Be aware of this should you be using `Introspection</api/language/introspection/introspection>` to check the name of a <span class="title-ref">DesktopContainer</span> instance.

</div>

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

### Miscellaneous issues

Use the Opening event for initialization instead of overriding the Constructor to allow all the controls to finish setting themselves up.

The Moved, Resized, and Resizing events fire on embedded containers when the window in which they are embedded is moved or resized.

The Show/Hide and the Visible property can be used to set the visibility of an embedded container.

Nesting <span class="title-ref">DesktopContainers</span> is allowed. However, you can't embed a <span class="title-ref">DesktopContainer</span> such that the containing <span class="title-ref">DesktopContainer</span> or a <span class="title-ref">DesktopContainer</span> higher in the containing chain is another instance of the same <span class="title-ref">DesktopContainer</span>; in other words, you can't recursively nest <span class="title-ref">DesktopContainers</span> in other instances of themselves.

Nested <span class="title-ref">DesktopContainer</span> coordinates for controls and events are automatically transformed for you. You don't need to worry about them unless you are dealing with global coordinates as you would for the `DesktopMenuItem's</api/user_interface/desktop/desktopmenuitem>` Popup method.

## Compatibility

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

<div class="seealso">

`DesktopWindow</api/user_interface/desktop/desktopwindow>` parent class

</div>
