1 Reply Latest reply on Mar 11, 2011 4:40 PM by curtis33321

    Strang behavior of dividers in HDividedBox when the first child in the HDividedBox is invisible

    Johnking08 Level 1

      I'm using Flex Builder 3. Here is a very simple example usinf HDividedBox:

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
          <mx:Script><![CDATA[
              private function init():void {
                  var len:uint = this.hdbox.numDividers;
                  mx.controls.Alert.show("number of divider: "+len);
              }
          ]]></mx:Script>
         
          <mx:HDividedBox id="hdbox" >
              <mx:VBox id="vb1" width="300" backgroundColor="yellow">
                  <mx:Label text="Name: " fontWeight="bold"/>
              </mx:VBox>
              <mx:VBox id="vb2" width="300" backgroundColor="blue" >
                  <mx:Label text="Email: " fontWeight="bold" />
              </mx:VBox>
              <mx:VBox id="vb3" width="300"  backgroundColor="red" >
                  <mx:Label text="Hometown: " fontWeight="bold"/>
              </mx:VBox>
          </mx:HDividedBox >
      </mx:Application>

       

      If you just run the code above, the dividers are in the right positions and the number of divider is 2 (which is correct).

       

      If you put visible="false" includeInLayout="false" with the first VBox (vb1) and run it, the number of divider is 1 (which is correct), but the divider is not put in between

      the VBox (vb2) and VBox (vb3). The divider is on top of VBox (vb2). If you drag the divider, it does not re-size the VBox (vb2) and VBox (vb3) correctly.

      This divider seems to be the divider between the VBox vb1 and VBox vb2. It looks like a bug. Did I do something wrong?

      Can someone comment on it?

       

      I do need to set the visible and includedInLayout attributes dynamically, but they cause problems when setting them to false.

        • 1. Re: Strang behavior of dividers in HDividedBox when the first child in the HDividedBox is invisible
          curtis33321 Level 1

          Yeah I could reproduce it in Flex 3.  It definitely looks like a bug.  I can't reproduce it in 4 though:

           

          this works.

          <?xml version="1.0" encoding="utf-8"?>

          <s:Application

           

           

          xmlns:fx="http://ns.adobe.com/mxml/2009"

          xmlns:s="

          library://ns.adobe.com/flex/spark"

          xmlns:mx="

          library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

          creationComplete="init()"

          >

           

           

          <fx:Script>

          <![CDATA[

           

           

           

          private function init():void {

           

          var len:uint = this.hdbox.numDividers;

          mx.controls.Alert.show(

          "number of divider: "+len);

          }

          ]]>

           

          </fx:Script>

           

           

          <fx:Declarations>

           

           

          <!-- Place non-visual elements (e.g., services, value objects) here -->

           

           

          </fx:Declarations>

           

          <mx:HDividedBox id="hdbox" >

           

          <mx:VBox id="vb1" width="300" backgroundColor="yellow" visible="false" includeInLayout="false">

           

          <mx:Label text="Name: " fontWeight="bold"/>

           

          </mx:VBox>

           

          <mx:VBox id="vb2" width="300" backgroundColor="blue" >

           

          <mx:Label text="Email: " fontWeight="bold" />

           

          </mx:VBox>

           

          <mx:VBox id="vb3" width="300" backgroundColor="red" >

           

          <mx:Label text="Hometown: " fontWeight="bold"/>

           

          </mx:VBox>

           

          </mx:HDividedBox >

          </s:Application>

          1 person found this helpful