Creating a Template with a Centered Element That Fills the Available Space

Let’s say you want to create a template containing a text field and a knob, where you want the text field to be resized horizontally when the size of the template is changed and where you want the knob to remain centered and unscaled.

Procedure

  1. For the text field, set Attach Ratio Left to 0/1 and Attach Ratio Right to 1/1.

    This way, the left edge always sticks to the left side of the template and the right edge follows the right edge of the template exactly. Changing the width of the template equally changes the size of the text field.

  2. For the knob, set Attach Ratio Left and Attach Ratio Right to 1/2.

Result

This way, resizing the template by 20 pixels will move the left and right borders of the knob by 10 pixels each, keeping the size of the knob unchanged and its position centered.