views:

36

answers:

2

I create an HBox, fill it with a grid of buttons, and set the scroll policy. When I resize the window, the stage changes size, and so does the HBox ... to a point. Once it reaches the height of the Grid it contains, it stops shrinking, like it has a "min-height". This ruins the scrollbar that I'm trying to establish in this case.

I've set the height to 100%, shouldn't it always take the height of the stage, it's parent?

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application 
xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="init();" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="100%"> 

<mx:Script>
    <![CDATA[
        import mx.controls.Button;
        import mx.containers.Grid;
        import mx.containers.GridRow;
        import mx.containers.GridItem;

        protected function init():void {    
            for (var i:int = 0; i < 3; i++) {
                var gRow:GridRow = new GridRow();
                gRow.percentWidth = 100;
                gRow.height = 100;
                var gItem:GridItem = new GridItem();
                gItem.percentWidth = 100;
                var btn:Button = new Button();
                btn.label = "BUTTON";
                btn.percentWidth = 100;
                btn.percentHeight = 100;
                gItem.addChild(btn);
                gRow.addChild(gItem);
                mainGrid.addChild(gRow);
            }       
        }         
  ]]>
</mx:Script>

<mx:HBox width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="on" id="main" clipContent = "true">
    <mx:Grid id="mainGrid" width="100%" height="100%" />
</mx:HBox>
</mx:Application>

Many thanks!

A: 

Hi,

you can try to give it the heigh of the HBox, as height="{hb.height}" ,hb as id

seismael
I could certainly set the HBox to reflect the height of the stage, but the whole reason I'm using Flex is because the Layout manager is supposed to handle that. I feel like I'm just missing a setting somewhere.
Whit
+2  A: 

So it looks like I managed to mention the eventual answer in my question. It's the "minHeight" property folks, looks like it gets set to the contained grids height, and will shrink no smaller. Set it to 0, and your good to go.

I hope this dialog I'm having with myself helps someone else. :)

Whit
+1 You've answered your own question. Two more votes and you'll get a self learner badge :)
Amarghosh