Simon,

I don't want the parent canvas to own the scrollbar. If I let the parent own the scrollbar, it obscures the right-most content of the VBox (or displays a horizontal scrollbar if I let it). I want the vbox to respect the height="100%" and thus have a height of 300 (in this example) and display a vertical scrollbar.

As Scott pointed out, binding the height of the VBox to the height of the parent achieves the result I'm looking for. I just expected the VBox to behave this way already.

The code I sent is a test case to illustrate the problem I've run into in my app. My app has a bunch of tabs and this particular tab contains a VBox that I'm using to display an arbitrary number of items that have varying heights. (Let's say it's a list of 20 blog entries). I'm using a VBox instead of a List control for several reasons, the two big ones being that I need smooth scrolling (itemRenderers in a List don't move as you scroll). and variable- height items. I started out using a List with variableRowHeight, but it was a pain. Since I didn't need any of the other List functionality and VBox provided everything I needed plus the smooth scrolling, here I am.

Thanks,

Tom


On May 5, 2007, at 3:35 PM, simonjpalmer wrote:

It will never show a scroll bar while you have
verticalScrollPolicy="off" in the parent canvas...

--- In [email protected], Tom Bray <[EMAIL PROTECTED]> wrote:
>
> Hi Jas,
>
> I expect the measuredHeight to be 612, which it is. The problem is
> that I also expect the VBox to respect the height of its parent
> canvas (300) and thus display a vertical scrollbar.
>
> Thanks,
>
> Tom
>
> On May 5, 2007, at 3:17 PM, Jas Kaur wrote:
>
> >
> > The value of height=200 is making this happen
> >
> > mx:Canvas width="100%" height="200" backgroundColor= "green"/>
> > <mx:Canvas width="100%" height="200" backgroundColor= "green"/>
> >
> > ----- Original Message ----
> > From: Tom Bray <[EMAIL PROTECTED]>
> > To: [email protected]
> > Sent: Saturday, May 5, 2007 5:36:08 PM
> > Subject: [flexcoders] Shouldn't this VBox have a scrollbar?
> >
> >
> > Shouldn't the height of the VBox below end up being 300? Shouldn't
> > height="100% " make it fill up the area allotted to it by it's
> > parent? Instead it ends up having a height of 612 and no scrollbar:
> >
> > <?xml version="1.0" encoding="utf- 8"?>
> > <mx:Application xmlns:mx="http://www.adobe. com/2006/ mxml"
> > layout="absolute" horizontalScrollPol icy="off" verticalScrollPolic
> > y="off">
> > <mx:Canvas width="500" height="300" horizontalScrollPol icy="off"
> > verticalScrollPolic y="off">
> > <mx:VBox id="badVBox" width="100%" height="100%">
> > <mx:Canvas width="100%" height="200" backgroundColor= "green"/>
> > <mx:Canvas width="100%" height="200" backgroundColor= "green"/>
> > <mx:Canvas width="100%" height="200" backgroundColor= "green"/>
> > </mx:VBox>
> > </mx:Canvas>
> >
> >
> > <mx:Button y="400" label="debug" click="debug( )"/>
> >
> >
> > <mx:Script>
> > <![CDATA[
> > public function debug():void
> > {
> > var v:VBox = badVBox;
> > }
> > ]]>
> > </mx:Script>
> >
> > </mx:Application>
> >
> >
> > The best gets better. See why everyone is raving about the All-new
> > Yahoo! Mail.
> >
> >
>




Reply via email to