Container - no Add Child option


#1

I have a small project with a few forms. I added a container to a new form. When I right-click on it, there is no option to ‘Add Child’. If I try to drag a control into the container, it jumps to outside of the container. Thoughts? DatatableSample.appstudio.zip (24.0 KB)


#2

The Add Child option doesn’t appear in the right click menu if there are no children to add. If you add a button to the form, then right click on your Container, the AddChild option will appear.

What control are you dragging to the Container? After you drag and drop it, does it appear in the Remove Child option when you right click on the Container?


#3

Excellent - many thanks. It works to pull the control onto the form, then right-click on container and pick Add Child > Control.

I was trying to drag the Bootstrap4 DataTable control - dragged it to the container, let go and the DataTable jumped to form just below the control. The container does not have the menu option Remove Child. Just Add Child with this control as the option.

Quick related question - when I add a container, it goes to the top left corner of the form. If I try to drag it into place, it won’t move. Thoughts? Position of form is relative. Thanks


#4

The DataTable automatically positions itself to the top left of its surrounding element. That can make it difficult to drag and drop. Instead, go into the Project Explorer, right click and cut, then right click and past into your Container.

What you are seeing when positioning elements in a relative container is correct. If you want to be able to drag controls to a position, use absolute positioning. Here are a couple of blog posts:
https://blog.nsbasic.com/2016/11/appstudio-6-positioning-controls/
https://blog.nsbasic.com/2016/11/appstudio-6-positioning-controls-ii/