Automatically positioning the controls based on the layout