Run the example below. Click the small text button and large text button to dynamically load small and large text dynamically.
The Vbox would automatically add scrollbars to accomodate the large text.

The key is in adding the minWidth="0" and minHeight="0" in the VBox.
Hope this solves your problem!

Sree

Example:
====================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
    width="100%" height="100%" initialize="loadSmallText();">
    <mx:Script>
        <![CDATA[

    var smallText:String = "This is small text. Ideally should not need a scrollbar"
    var largeText:String = "Old question, but did not find working solutions. I have a structure in a tab navigator (see below) and I would like to have the scrollbar (when needed) in a specific place. The tab contains a HBox and a Form. HBox is of fixed size and place and should always be visible - no scrollbar. The contents of the Form are created dynamically and are of various sizes and formats. The Form should have a scrollbar when needed. Now the scrollbar is always on parent container, VBox, so that the fixed-place HBox scrolls as well."
   
    function loadSmallText() {
        textX.text = smallText;   
    }
   
    function loadLargeText() {
        textX.text = largeText;
    }

]]>
    </mx:Script>
    <mx:VBox width="100" height="200">
        <mx:Text id="textX" />
    </mx:VBox>
    <mx:Button label="Small Text" click="loadSmallText();" />
    <mx:Button label="Large Text" click="loadLargeText();" />
</mx:Application>

====================================================
svktiilikainen wrote:
Yes, tried it and it does not work.
Perhaps the problem comes from loading the form contents
dynamically - the form does not know its size when it is initialized
and so does not know it needs a scrollbar?

Satu

> Hi,
>
> Have you tried placing the form inside a box? That way when the
form
> is too large for the box its in it should scroll by default.
Without
> mocking up your problem yet that would be my first attempt at it.
>
> cheers
>
> Andy
>
> --
> Andy Rayne
> Senior Consultant
> Macromedia Consulting (EMEA)
> [EMAIL PROTECTED]

> Office: + 44 (0) 131 338 6902
> Mobile: +44 (0) 7917 428 950
>
> --- In flexcoders@yahoogroups.com, "svktiilikainen"
> <[EMAIL PROTECTED]> wrote:
> >
> > Old question, but did not find working solutions.
> >
> > I have a structure in a tab navigator (see below) and I would
like
> > to have the scrollbar (when needed) in a specific place. The tab
> > contains a HBox and a Form. HBox is of fixed size and place and
> > should always be visible - no scrollbar. The contents of the
Form
> > are created dynamically and are of various sizes and formats.
The
> > Form should have a scrollbar when needed. Now the scrollbar is
> > always on parent container, VBox, so that the fixed-place HBox
> > scrolls as well.
> >
> > Setting the sizes does not seem to help, neither does setting
> > vScrollPolicy on various components. How can I force the
scrollbar
> > on the Form "scrollableContents"?
> >
> >
> > <mx:TabNavigator>
> >   <mx:VBox id="myTab" width="100%" height="100%">
> >
> >     <mx:HBox id="fixedField" width="100%" height="40">
> >       <!-- label and text inputs here, no scroll needed -->
> >     </mx:HBox>
> >
> >     <mx:Form id="scrollableContents" width="100%" height="100%">
> >       <!-- contents: formitems etc. created dynamically with
> > createChild()-->
> >     </mx:Form>
> >
> >   </mx:VBox>
> > <!-- other tabs here -->
> >
> > </mx:TabNavigator>
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to