[Lazarus] Align/Anchor to widest label

Henry Vermaak henry.vermaak at gmail.com
Wed Mar 25 11:20:34 CET 2015


On Wed, Mar 25, 2015 at 10:52:01AM +0100, Torsten Bonde Christiansen wrote:
> Is it possible by using align, anchor, or some third option, to
> always make the two edits and the drop-down box align with the
> widest of the three labels.
> 
> Since these labels will be translated to many languages I cannot
> assume that the 2nd labels is the widest, hence anchoring the
> filename edit to that label, and the drop-down and directory edit to
> the filename edit, will make the controls overlap eachother.

This has been quite a big problem for me, too.  The only solution I've
found is to use a container, like a frame or a panel, that has the
ChildSizing property.  Then you can set the ChildSizing.ControlsPerLine
to 2 and the container will take care of making sure that everything is
aligned, as long as you add the controls in the correct order, which
will depend on the ChildSizing.Layout setting.

The pain comes when you need to change the controls, because the child
sizing works on the order that the controls are added to the container.
For this reason I usually do this in code.

Henry




More information about the Lazarus mailing list