DesktopContainers

i try to create DesktopContainers in a window with xojo 2021r3 at runtime.
whatever i do it does not work^^

window
—board
------Title
------Column
---------Card
---------Card
------Column
---------Card
---------Card

Me.Close '<- remove the button

Var board As New ContainerBoard '<- super is DesktopContainer

board.Left = 10
board.Top = 10
board.Width = Self.Width -10*2
board.Height = Self.Height -10*2

'Window1.ButtonCreateUI.Pressed, line 10
'Parameter "control" expects Class DesktopUIControl, but this Is Class ContainerBoard.ContainerBoard.

Self.AddControl(board) '<- add to window ?

Since DesktopContainer isn’t a DesktopUIControl, I believe you’d like to do this :wink:

Var board As New ContainerBoard '<- super is DesktopContainer

board.Left = 10
board.Top = 10
board.Width = Self.Width -10*2
board.Height = Self.Height -10*2

board.EmbedWithin(Self, board.Left, board.Top)

But I agree @Xojo (@Geoff_Perlman) should add another Method DesktopWindow/DesktopContainer.AddContainer to be consistent in naming and across other supported targets.

1 Like

@Martin T thank you

i thought there was some clean up with new desktop controls.
but DesktopContainer seems still special same before.

i just want

DesktopContainer = Control
DesktopButton = Control
.AddControl(Control)
.RemoveControl(Control)
.FindControl(Control)

and then something like

For Each c As ContainerCard In Self.Controls
 c.Close
Next

or

For Each c As Object In Self.Controls
 if c IsA ContainerCard then c.Close
Next

DesktopContainers are still special in many ways, and I’d doubt we’ll see that change significantly in the near future. They are subclasses of DesktopWindow, and many of their references that you can access still take you back to something like EmbeddedWindowControl, such as when iterating over controls on a DesktopWindow.

1 Like