DesktopContainer.EmbedWithin
From Xojo Documentation
New in 2021r3
Supported for all project types and targets.
Embeds the DesktopContainer in window ContainingWindow.
Notes
The optional Left and Top parameters determine the location of the top-left corner, relative to the containing window. The optional parameters Width and Height determine the size of the embedded DesktopContainer.
New in 2021r3
Supported for all project types and targets.
Embeds the DesktopContainer in the specified Container control.
Notes
The DesktopContainer is embedded on the passed control (which becomes the parent of the DesktopContainer). If the DesktopContainer is embedded on a DesktopPagePanel or DesktopTabPanel, it is embedded on the current page. However, you should use EmbedWithinPanel for this purpose instead as it allows you to specify the page.
The optional Left and Top parameters determine the location of the top-left corner, relative to the containing control. If the DesktopContainer 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 embedded DesktopContainer.
Notes
An instance of a DesktopContainer can only be embedded into one object.
If you want to dynamically embed containers into each other, make sure that you first embed the containers that you wish to use as a source for other containers. Failure to do this will result in a run-time error.
Sample Code
This code is in the Pressed event of a button and add a DesktopContainer to a window:
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.
Elsewhere you can remove the container: