Hi guys,

I'm trying to work out how to use the Flex 3 constraints to replace a 
currently hand-coded layout. I'm running into a problem with 
content-sized constraints: how to have child components that position 
themselves on a particular constraint but don't actually affect the size 
of that constraint?

The layout I'm looking for is this (each letter represents a component):

A  PMT  C
       D

Component PMT is the central component: the other components need to be 
a set distance to the left (A), right (C) or below (D).

I've specified the constraints like so:

         <view:Schematic id="schematic"> (Schematic is a Canvas)
                <view:constraintColumns>
                    <mx:ConstraintColumn id="pmtLeft"/> (A is specified 
as right="pmtLeft:0")
                    <mx:ConstraintColumn id="pmtCentre"/> (PMT & D are 
specified as horizontalCenter="pmtCentre:0")
                    <mx:ConstraintColumn id="pmtRight" /> (C is 
specified as left="pmtRight:15")
                </view:constraintColumns>
                <view:constraintRows>
                    <mx:ConstraintRow id="pmtTop" />
                    <mx:ConstraintRow id="pmtMiddle" />
                    <mx:ConstraintRow id="pmtBottom" />
                </view:constraintRows>
            </view:Schematic>

So pmtLeft is sized to the width of A, pmtRight to the width of C, and 
pmtCentre to the width of PMT or D, whichever is greater. The problem is 
I need pmtCentre to be sized to the width of PMT only, and ignore the 
width of D. Yet I still need D centred on pmtCentre.

I need the content-sized constraints, so PMT can be changed, but I also 
need D to be able to grow wider than its constraint. I.e. D needs to be 
centred under PMT but not affect the width of the "pmtCentre" 
ConstraintColumn. Is this possible? I tried includeInLayout="false" but 
that didn't do anything.

I guess I'm looking for the equivalent of spanCols/spanRows for constraints.

Am I missing something or is this a limitation of the enhanced 
constraints? If it is a limitation then they aren't as useful as claimed...

Any alternatives suggested would be welcome too.

Cheers,
Charlie

Reply via email to