Containers are described as being ‘parents’ to the controls placed within them. In what sense? If I place a button , MyGroupBoxButton in a group box and I place another Button, OutsideButton, in the Window and place in the button pressed event MyGroupBoxButton.caption = “New Name” this will change the button’s caption. Based on the parent description I would expect groupbox1.MyGroupBoxButton.caption = “New Name” to be necessary. It is not and will not be acceptable to the compiler. So what does parent mean in this context?
I don’t know the inner workings behind containers but I just think of them as control placement methods. So you can edit in one place and change many instances.
From a structure pov they seem just like a control wrapper class as you create instances of them from the library like a regular control.
You can put many controls of different types into a Container and then place instances of that container in different places. You can create new instances of the container, in code, and then use embedWithin to place that new container instance in a window or into another container instance. I do that in the Search page in my app. The user wants another search clause or criterion? They click plus and there it appears and allows them to do a more complex search.
A GroupBox is not a “Container” in Xojo terminology. A Container as discussed in other replies is a subclass of Window. Containers can be embedded in windows and have controls placed in them either in the IDE or in code. A Container with controls in it can be used as a self-contained “control” itself. Once a Container is defined, additional instances can be created without having to individually populate them with the controls that the “prototype” contains. Since Containers are related to Windows, controls within them can be accessed as they would with a Window, e.g. MyContainer.MyButton.
A GroupBox is a control into which other controls can be placed in the IDE to provide visual differentiation in your UI, and a caption. All controls in the GroupBox can be enabled/disabled by enabling or disabling the GroupBox, and you can move them all around in the IDE by just moving the GroupBox. You can tell when a control is the parent of another control in the IDE when the parent control’s border turns red when the control is selected or moved (sometimes you have to move a control around and/or bring it to the front in order to initially “set” the parent). Other controls like TabPanels and PagePanels can also be parents, but in none of these cases does the name of a control not in a Container reflect its parent hierarchy - it will always be “MyWindow.MyButton”, not MyWindow.MyGroupBox.MyButton.
The more complex a window is the more important containers are. I have a window with 27 containers in 4 levels. The containers allow me to define communication between the containers so that I can manage the complexity.