Does anyone know how to use the Margin and Padding fields?
Apparently they can be used in place of Anchors, since FM doesn't support Anchors. I've been playing around with them this morning but couldn't get them to act in the way I wanted. eg, I would like two buttons to be anchored to the right and bottom of a form so that when the form is resized the buttons move with the form.
To do what you want, place a TLayout on your form and set its alignment to "bottom". Inside, you can place the two buttons you want to have.
Set the height of the Layout to the height of the buttons plus any margin you want the buttons to have from the edge of the form. Assume you want to stay 10 pixels away from the bottom and the right of the form, and a button is 25 pixels high, then the height of the layout is 35.
Set the right and bottom margin of the layout to 10, and then set the alignment of the rightmost button to "right". Give the rightmost button a left padding of, say, 15, and now set the alignment of the other button to "right" too. Now the buttons are right aligned in the layout, and the layout is bottom aligned to the form. In effect, the buttons will stay in the bottom right corner or the form.
#
#
-------+--------+------------------+----#
| |H=25 (Button) | #H=35 (Layout)
| 15 | | 10 #
-------+ padd. +------------------+ #
10 bot layout mrgn #
#########################################
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With