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

</div>

Class

# ContainerControl (deprecated)

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

<div class="warning">

<div class="title">

Warning

</div>

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

</div>

## Description

Used to embed a group of controls in a `Window</api/deprecated/window>` or in another `control</api/deprecated/rectcontrol>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                        | Type                                       | Read-Only | Shared |
|-------------------------------------------------------------|--------------------------------------------|-----------|--------|
| `AllowAutoDeactivate<containercontrol.allowautodeactivate>` | `Boolean</api/data_types/boolean>`         |           |        |
| `AllowFocus<containercontrol.allowfocus>`                   | `Boolean</api/data_types/boolean>`         |           |        |
| `AllowFocusRing<containercontrol.allowfocusring>`           | `Boolean</api/data_types/boolean>`         |           |        |
| `AllowTabs<containercontrol.allowtabs>`                     | `Boolean</api/data_types/boolean>`         |           |        |
| `Composited<containercontrol.composited>`                   | `Boolean</api/data_types/boolean>`         |           |        |
| `Enabled<containercontrol.enabled>`                         | `Boolean</api/data_types/boolean>`         |           |        |
| `LockBottom<containercontrol.lockbottom>`                   | `Boolean</api/data_types/boolean>`         |           |        |
| `LockLeft<containercontrol.lockleft>`                       | `Boolean</api/data_types/boolean>`         |           |        |
| `LockRight<containercontrol.lockright>`                     | `Boolean</api/data_types/boolean>`         |           |        |
| `LockTop<containercontrol.locktop>`                         | `Boolean</api/data_types/boolean>`         |           |        |
| `Parent<containercontrol.parent>`                           | `RectControl</api/deprecated/rectcontrol>` |           |        |
| `Tooltip<containercontrol.tooltip>`                         | `String</api/data_types/string>`           |           |        |
| `Transparent<containercontrol.transparent>`                 | `Boolean</api/data_types/boolean>`         |           |        |
| `Window<containercontrol.window>`                           | `Window</api/deprecated/window>`           |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                  | Parameters                                                                                                                                                                                                                                                                                  | Returns | Shared |
|-------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `EmbedWithin<containercontrol.embedwithin>`           | ContainingWindow As `Window</api/deprecated/window>`, \[left As `Integer</api/data_types/integer>`, top As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`\]                                                  |         |        |
|                                                       | ContainerControl As `RectControl</api/deprecated/rectcontrol>`, \[left As `Integer</api/data_types/integer>`, top As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`\]                                        |         |        |
| `EmbedWithinPanel<containercontrol.embedwithinpanel>` | ContainingPanel As `PagePanel</api/deprecated/pagepanel>`, Page As `Integer</api/data_types/integer>`, \[left As `Integer</api/data_types/integer>`, top As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`\] |         |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                    | Parameters | Returns |
|-----------------------------------------|------------|---------|
| `GotFocus<containercontrol.gotfocus>`   |            |         |
| `LostFocus<containercontrol.lostfocus>` |            |         |

## Property descriptions

<div id="containercontrol.allowautodeactivate">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.AllowAutoDeactivate

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

Determines whether the control should be deactivated (on macOS) when the parent window is deactivated.

This example turns AllowAutoDeactivate off.

``` xojo
ContainerControl11.AllowAutoDeactivate = False
```

<div id="containercontrol.allowfocus">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.AllowFocus

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

If `True</api/language/true>`, the control will be included in the Tab order and can accept the focus. The `GotFocus<containercontrol.gotfocus>` and `LostFocus<containercontrol.lostfocus>` events are called at the appropriate times.

Some controls automatically allow focus, e.g. text fields or lists, so they do not have AllowFocus property.

<div class="note">

<div class="title">

Note

</div>

Not all controls allow focus on every platform.

</div>

This code enables the AllowFocus property. It is in the Open event of the control.

``` xojo
Me.AllowFocus = True
```

<div id="containercontrol.allowfocusring">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.AllowFocusRing

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

If `True</api/language/true>`, the <span class="title-ref">ContainerControl</span> 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="containercontrol.allowtabs">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.AllowTabs

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

If `True</api/language/true>` and `AllowFocus<containercontrol.allowfocus>` is `True</api/language/true>`, then pressing Tab triggers the `KeyDown</api/deprecated/rectcontrol>` event for processing.

If AllowTabs is `False</api/language/false>`, pressing the Tab key does not trigger the `KeyDown</api/deprecated/rectcontrol>` event; pressing Tab triggers the LostFocus event and selects the next object in the `Window</api/deprecated/window>` that can accept the focus.

<div id="containercontrol.composited">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.Composited

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

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

<div id="containercontrol.enabled">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.Enabled

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

Determines if the <span class="title-ref">ContainerControl</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">ContainerControl</span>.

``` xojo
ContainerContol11.Enabled=False
```

<div id="containercontrol.lockbottom">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.LockBottom

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

Determines whether the bottom edge of the <span class="title-ref">ContainerControl</span> should stay at a set distance from the bottom edge of the parent `control</api/deprecated/rectcontrol>`, if there is one, or the owning `Window</api/deprecated/window>`.

``` xojo
Me.LockBottom = True
```

<div id="containercontrol.lockleft">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.LockLeft

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

Determines whether the left edge of the <span class="title-ref">ContainerControl</span> should stay at a set distance from the left edge of the parent `control</api/deprecated/rectcontrol>`, if there is one, or the owning `Window</api/deprecated/window>`.

Beginning with version 2009r5, `LockTop<containercontrol.locktop>` and `LockLeft<containercontrol.lockleft>` default to `True</api/language/true>` when you add a control to a window. Existing controls will be altered only if `LockRight<containercontrol.lockright>` and/or `LockBottom<containercontrol.lockbottom>` are not set.

<div id="containercontrol.lockright">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.LockRight

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

Determines whether the right edge of the <span class="title-ref">ContainerControl</span> should stay at a set distance from the right edge of the parent `control</api/deprecated/rectcontrol>`, if there is one, or the owning `Window</api/deprecated/window>`.

``` xojo
Me.LockRight = True
```

<div id="containercontrol.locktop">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.LockTop

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

Determines whether the top edge of the <span class="title-ref">ContainerControl</span> should stay at a set distance from the top edge of the parent `control</api/deprecated/rectcontrol>`, if there is one, or the owning `Window</api/deprecated/window>`.

Beginning with version 2009r5, `LockTop<containercontrol.locktop>` and `LockLeft<containercontrol.lockleft>` default to `True</api/language/true>` when you add a control to a window. Existing controls will be altered only if `LockRight<containercontrol.lockright>` and/or `LockBottom<containercontrol.lockbottom>` are not set.

``` xojo
Me.LockTop = True
```

<div id="containercontrol.parent">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.Parent

**Parent** As `RectControl</api/deprecated/rectcontrol>`

Gets the containing control, if any.

<div id="containercontrol.tooltip">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.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="containercontrol.transparent">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.Transparent

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

If `True</api/language/true>`, the background shows through to the <span class="title-ref">ContainerControl</span>; if `False</api/language/false>`, the <span class="title-ref">ContainerControl</span> is opaque. The default is True.

ContainerControls 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">ContainerControl</span> flickers less on Windows, is more optimized on macOS, and on Linux child controls on <span class="title-ref">ContainerControl</span> are clipped properly.

This example turns Transparent off:

``` xojo
Me.Transparent = False
```

<div id="containercontrol.window">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.Window

**Window** As `Window</api/deprecated/window>`

Gets the containing window.

## Method descriptions

<div id="containercontrol.embedwithin">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.EmbedWithin

**EmbedWithin**(ContainingWindow As `Window</api/deprecated/window>`, \[left As `Integer</api/data_types/integer>`, top As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`\])

Embeds the <span class="title-ref">ContainerControl</span> in the specified *Container* control.

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

<div class="rst-class">

forsearch

</div>

ContainerControl.EmbedWithin

**EmbedWithin**(ContainerControl As `RectControl</api/deprecated/rectcontrol>`, \[left As `Integer</api/data_types/integer>`, top As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`\])

Embeds the <span class="title-ref">ContainerControl</span> in the specified *Container* control.

This code is in the Action event of a button and add a container control 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="containercontrol.embedwithinpanel">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.EmbedWithinPanel

**EmbedWithinPanel**(ContainingPanel As `PagePanel</api/deprecated/pagepanel>`, Page As `Integer</api/data_types/integer>`, \[left As `Integer</api/data_types/integer>`, top As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`\])

Embeds the <span class="title-ref">ContainerControl</span> on a page in the passed `PagePanel</api/deprecated/pagepanel>` or `TabPanel</api/deprecated/tabpanel>`.

An instance of a <span class="title-ref">ContainerControl</span> can only be embedded into one page.

The <span class="title-ref">ContainerControl</span> is embedded on the passed page and the containing control is the parent of the <span class="title-ref">ContainerControl</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">ContainerControl</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">ContainerControl</span>.

This example adds a new tab to a `TabPanel</api/deprecated/tabpanel>` and then add a <span class="title-ref">ContainerControl</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)
```

## Event descriptions

<div id="containercontrol.gotfocus">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.GotFocus

**GotFocus**

Called when the <span class="title-ref">ContainerControl</span> gets focus.

The AllowFocus property must be set to True in order for this event to be called.

<div id="containercontrol.lostfocus">

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

</div>

<div class="rst-class">

forsearch

</div>

ContainerControl.LostFocus

**LostFocus**

Called when the <span class="title-ref">ContainerControl</span> loses focus.

The AllowFocus property must be set to True in order for this event to be called.

## Notes

<div class="warning">

<div class="title">

Warning

</div>

In the Layout Editor, do not layer other controls onto ContainerControls that have been added to a Window layout. Controls added this way are not part of the <span class="title-ref">ContainerControl</span> and will not display properly. Instead, add your controls directly to the <span class="title-ref">ContainerControl</span> in its layout.

</div>

<div class="warning">

<div class="title">

Warning

</div>

ContainerControls can not be part of a Control Set.

</div>

ContainerControl is not a `Control</api/deprecated/control>` (despite its name), nor is it a `Window</api/deprecated/window>`. It is a separate class that is similar to `Control</api/deprecated/control>` and to `Window</api/deprecated/window>`, providing many of the same events, properties, and methods. Like a `Window</api/deprecated/window>`, a <span class="title-ref">ContainerControl</span> can encapsulate related `Controls</api/deprecated/control>` (and other ContainerControls) in a self-contained, reusable class. Like a `Control</api/deprecated/control>`, a <span class="title-ref">ContainerControl</span> can be added to a `Window</api/deprecated/window>`, a `TabPanel</api/deprecated/tabpanel>`, a `PagePanel</api/deprecated/pagepanel>`, or to another <span class="title-ref">ContainerControl</span>.

You can embed a <span class="title-ref">ContainerControl</span> in a `Window</api/deprecated/window>` or <span class="title-ref">ContainerControl</span> in either the IDE or via code. Multiple levels of embedding are supported.

To add the <span class="title-ref">ContainerControl</span> to a window via code, use either the EmbedWithin or EmbedWithinPanel methods. Use EmbedWithin to embed the <span class="title-ref">ContainerControl</span> in either a window or a control, depending on whether the first parameter is a `Window</api/deprecated/window>` or a `control</api/deprecated/rectcontrol>`. For the special case of embedding within a `PagePanel</api/deprecated/pagepanel>` or a `TabPanel</api/deprecated/tabpanel>`, use EmbedWithinPanel instead. It allows you to pass the page number on which the <span class="title-ref">ContainerControl</span> will be embedded. To remove the container, use the Close method.

The following statement embeds a <span class="title-ref">ContainerControl</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
ContainerControl1.EmbedWithin(Self, 50, 100)
```

When the project is run, the controls in the <span class="title-ref">ContainerControl</span> appear in the default window, Window1. Use the same approach to embed the <span class="title-ref">ContainerControl</span> in a control other than a PagePanel or TabPanel; for the latter types of controls, use EmbedWithinPanel and pass the name of the control and the desired panel number.

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

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

A <span class="title-ref">ContainerControl</span> either has its own keyboard focus and menu handling, or it shares these elements with its containing `Window</api/deprecated/window>`. Which behavior is chosen depends on the state of the AllowFocus flag when the <span class="title-ref">ContainerControl</span> is embedded. When AllowFocus is `True</api/language/true>`, the <span class="title-ref">ContainerControl</span> does not share focus with the containing `Window</api/deprecated/window>`. 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 ContainerControls and relate to its behavior when embedded; these behave like the corresponding properties of the `Canvas</api/deprecated/canvas>` control. These include the following: LockLeft, LockTop, LockRight, LockBottom, Enabled, AutoDeactivate, HelpTag, UseFocusRing, AllowFocus, AllowTabs, Parent and Window.

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

### Miscellaneous issues

Use the Open 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 windows when the embedded window is moved or resized.

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

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

Nested <span class="title-ref">ContainerControl</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 `MenuItem's</api/deprecated/menuitem>` Popup method.

## Compatibility

All project types on all supported operating systems.

## See also

`Object</api/data_types/additional_types/object>` parent class; `Window</api/deprecated/window>` classes
