Pinning GUI Components to FireMonkey

Just started testing FireMonkey and can't find a way to make dynamically sized / positioned components.

VCL had the Anchor property, FM does not.

Does anyone see what I missed

Update:

Simple snap is not available in FM. You need to create TLayouts and align them, and then place the controls inside the panel so that they get stuck. If you used an older version of Builder or Delphi, it will be the same as we used to do with TPanels.

+7
source share
5 answers

This is the answer to your question. The anchors property in VCL seems to have been replaced by Margins and Padding (due to performance reasons) and I found some documentation on the XE2 wiki ( http://docwiki.embarcadero.com/RADStudio/en/FireMonkey_Application_Design ). I doubt that the anchors will be introduced later. To bind the two buttons ("OK" and "Cancel") at the bottom of the form on the right, do the following. See the images below for the OK and Cancel buttons.

enter image description here

Place a small panel aligned at the bottom on a shape, say about 40 height. Set the "Fields" on the bottom panel to create a smaller space in which the buttons will live, make sure that you set the button's alignment to the right. For example, the gap between the right edge of the form and the right button has an edge 15. The upper and lower margins were set to 12. This captures the right big button.

"Fill" is the opposite of a field, the filling of which places space outside the control. To the right of the button itself, I added a gasket 20 to the left side, this will be the space between the two buttons. For the second button to the left of the first, all we need to do is set the align property to alRight, no need to adjust the indentation or margins.

+11
source

Drop a few TLayout components in the form and adjust their alignment properties as desired. Throw other components into these layouts and set their alignment properties relative to the TLayout in which they are contained. Seems to work for me ...

+7
source

Here is the answer you are looking for: FMX controllers do not have anchors.

I assume that this will be a feature of the β€œnext version”.

+5
source

A quick look at the align property reveals far more options than previous versions of Delphi:

enter image description here

Does your problem solve (at least in part).
I remember that I use OK for a long time, just using the nested panel and align layout elements.

+1
source

You can use LiveBindings and expressions to set the properties of your control based on the parent control, although it works a lot.

Otherwise, use fields and fields (e.g. HTML / CSS).

0
source

All Articles