Search code examples
apache-flexflex-spark

Flex Spark Form Horizontal layout


I have a Spark form with horizontal layout and I would like to reduce the top and bottom vertical padding. Neighter using the paddingBottom/paddingTop on the HorizontalLayout nor using the paragraphSpaceAfter/paragraphSpaceBefore of the FormItem reduces the vertical space before and after the form.

<s:Form width="100%" height="50%" fontSize="15">
    <s:layout>
        <s:HorizontalLayout  verticalAlign="middle"  gap="3" paddingBottom="0" paddingTop="0">
        </s:HorizontalLayout>
    </s:layout>
    <s:FormItem   > 
        <mx:DateField id="selDateFrom" formatString="DD/MM/YYYY" selectedDate="{new Date()}">
        </mx:DateField>
    </s:FormItem>
    <s:FormItem > 
        <mx:DateField id="selDateTo" formatString="DD/MM/YYYY" >
        </mx:DateField>
    </s:FormItem>
</s:Form>

Can someone help me?

Davide


Solution

  • I create a custom FormSkin like this one and it works:

      <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
            xmlns:s="library://ns.adobe.com/flex/spark" 
            xmlns:fb="http://ns.adobe.com/flashbuilder/2009" 
            alpha.disabled="0.5">
        [...]
        <s:Group id="contentGroup" showErrorSkin="true" showErrorTip="true" 
                 left="0" right="0" top="0" bottom="0">
            <s:layout>
                <s:FormLayout gap="7"/>
            </s:layout>
        </s:Group>
      </s:Skin>
    

    Thanks