I add an empty GroupBox to a tab on my form and move existing components on to it by selecting them and dragging them onto it. Then I set the Z-order of the GroupBox by sending it to the back so as to make my newly added components visible.
If I understand correctly you drag the controls in the *Form Designer* into the GroupBox? This does not work, the controls do not become children of the Groupbox this way. You can see this when you drag the GroupBox to another place - do the controls follow? If not I am right and you should continue reading.
There are two ways (maybe more) how to bring the controls into the GroupBox:
- Right-click on the control to be moved into the GroupBox. In the context menu there is a "Change Parent". Select the Groupbox in the list and click OK.
- Select the node of the control in the ObjectTree above the Object Inspector and drag it immediately below the Groupbox node - there is an insertion line when the location is correct.
In both cases, it may happen that the control is not visible any more. This is because its coordinates (left, top) are not changed but are considered to be relative to the GroupBox. Thus, if the control was located at 0, 400, and the groupbox is only 200 pixels high the control will be beyond the lower end of the groupbox. With the control selected (or select its node in the Object Tree), set its property "Top" to some value within the GroupBox (0 is always correct) and then drag it to its final location. The same, of course, with "Left".
If you now drag the Groupbox to another location, the control will follow.