views:

27

answers:

1

I'm pretty sure my dynamic mxml layout must give me two scrollbars (horizontal and vertical) but it only shows vertical one. Am I missing something or is it a bug?

<?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" width="100%" height="100%" xmlns:local="*">
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;

            [Bindable]
            public var myData:ArrayCollection = new ArrayCollection([
                {name:"Jane"},
                {name:"Sonny"},
                {name:"Alicia"}
            ]);
        ]]>
    </fx:Script>
    <s:Scroller width="100%" height="100%">
        <s:VGroup>
            <s:Group minHeight="600" minWidth="800" height="100%" width="100%">
                <mx:HDividedBox id="div1" width="100%" height="100%" autoLayout="true" liveDragging="true">
                    <mx:DataGrid width="100%" height="100%" dataProvider="{myData}"/>
                    <mx:DataGrid width="100%" height="100%" dataProvider="{myData}"/>
                </mx:HDividedBox>
            </s:Group>
        </s:VGroup>
    </s:Scroller>
</s:Application>
A: 

You haven't set horizontalScrollPolicy and verticalScrollPolicy for the Scroller and hence they have their value set to the auto. The behavior in this case is to display the scrollbars only if necessary.

The scroll bars are displayed according to the vertical and horizontal scroll bar policy, which can be auto, on, or off. The auto policy means that the scroll bar will be visible and included in the layout when the viewport's content is larger than the viewport itself.

Try with

<s:Scroller width="100%" height="100%" horizontalScrollPolicy="on">
Amarghosh
Have you tried it?This will make horizontal scrollbar component to appear but it will be disabled forever regardless of application window size and I need it to work when the window width is less than minWidth of the content. So far all works nice for minHeight but the same logic breaks on horizontal scrollbar.You can easily check it by pasting my code into empty flex project and compiling it.
Nek