apache-flexformslayoutlabelright-justified

Flex Forms: getting labels to line up, right-justified


I thought this was the default behaviour (all the Adobe docs seem to indicate that this is the case). Say you have a form: Name: [______] Password: [________]

generally you want Name and Password to line up on their right-hand side (right justification). The length should be the length of the longest label.

When I add the following code to my MXML (authoring in Flex 4) it does not do that at all! But rather tjust crams everything left-justified, similar to the Name/Password example above.

What's the solution?

<s:Form id="directoryForm_A" width="100%">                      
    <s:layout>
        <s:VerticalLayout horizontalAlign="justify"/>
    </s:layout>
    <s:FormItem label="Click">
        <s:Button label="Button"/>
    </s:FormItem>
    <s:FormItem label="Root Directory">
        <s:TextInput x="0" width="100%" enter="handleUserSetRootDirectory(event)"/>
    </s:FormItem>
</s:Form>

Solution

  • Which Adobe docs were you reading? You realize that the Spark Form are going to be very different than the Halo / MX Form. I would also suspect that the Spark form is not working yet.

    Here are the docs on the Spark Form.

    I think you'll benefit from reading the layout rules section of the FormItemLayout details. I cannot find the documentation that claims that all labels will be right aligned.