ThisRestlessPilgrim
ThisRestlessPilgrim

Reputation: 531

Flex FormItems don't honour Form width

When I have a Form object with a width of 200px and a FormItem child with a width of 100%, the FormItem does not appear to be constrained by its parent's width of 200px when it contains a child element that's really big. Why? How do I stop this?

<mx:Form width="200" backgroundColor="red">
    <mx:FormItem label="Field:" width="100%" backgroundColor="yellow">
        <!-- This component will force the FormItem to grow larger than the form... -->
        <mx:ComboBox>
            <mx:dataProvider>
                <mx:ArrayCollection>
                    <mx:String>A very, very long string which will force the form to expand</mx:String>
                </mx:ArrayCollection>
            </mx:dataProvider>
        </mx:ComboBox>
    </mx:FormItem>          
</mx:Form>  

(I'm actually trying to write a version of the ComboBox which will size itself normally, but if it's too big for its parent it just snaps to 100% width and truncates the text)

Upvotes: 0

Views: 135

Answers (1)

ThisRestlessPilgrim
ThisRestlessPilgrim

Reputation: 531

The ComboBox will respect its parent's dimensions if you set minWidth=0 and percentWidth=100.

Upvotes: 1

Related Questions