I believe DivBox essentially calls getExplicitOrMeasuredHeight() on the
children.  I would check to see if the Panel returns 200 due to its
contents.  It might just be a coincidence.

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik Price
Sent: Friday, September 21, 2007 12:40 PM
To: [email protected]
Subject: [flexcomponents] DividedBox resizes children to equal
proportions when using custom component

 

Hi,

I have a VDividedBox, which contains two children -- the first child is
a Panel and the second is a Canvas (so the Panel is on top).  The Panel
specifies a height of 100%, the Canvas specifes a pixel height of 200.
Something like this: 

<mx:VDividedBox>
  <mx:Panel width="100%" height="100%"/>
  <mx:Canvas width="100%" height="200"/>
</mx:VDividedBox>

I have written a simple custom component that extends Box and wraps a
child of a DividedBox, to add some hooks into that DividedBox.
Everything seems to work fine, except that when the display list is
initially rendered (at application startup time), the DividedBox always
divides its vertical space equally between the two children.  In other
words, the Panel has 50% of the vertical height, and the Canvas (which
is wrapped by my custom component) has 50% of the vertical height.  Here
is a simplification of what my code looks like: 

<mx:VDividedBox>
  <mx:Panel width="100%" height="100%"/>
  <MyBox>
    <mx:Canvas width="100%" height="200"/>
  </MyBox>
</mx:VDividedBox>

I have tried many combinations of setting widths and heights on the
various components, for example, moving the absolute height of 200px
from the Canvas to the MyBox, etc.  Nothing seems to matter -- the
VDividedBox always divides its vertical real estate equally between its
two children.  I may have missed some step in implementing the various
lifecycle methods of a custom component, but I had hoped most of the
layout-related information would be inherited from the Box superclass.
Does anyone know what criteria the DividedBox is using to decide whether
to divide the vertical space equally among its children, or to respect
their wishes to be a certain height?  (FWIW it seems that it is using a
method of class "Flex" called "flexChildHeightsProportionally", but what
I'm trying to figure out is *why* it's using that method at all.) 

Thanks,

Erik

 

Reply via email to