It's something I keep needing, so very soon I'm going to cook up an example
of a "one-child-only" container that will behave the way I think they should
regarding vertical scrollbars. Will post a link :)

-Josh

On Wed, Jul 23, 2008 at 11:12 PM, Richard Rodseth <[EMAIL PROTECTED]>
wrote:

> Yes, but that doesn't look so good and wastes real estate. I think I
> can live with the overlay, given the padding I have.
>
> On Wed, Jul 23, 2008 at 12:15 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
> > If you set verticalScrollPolicy="on" then the scrollbars will be factored
> in
> >
> >
> >
> > ________________________________
> >
> > From: [email protected] [mailto:[EMAIL PROTECTED] On
> > Behalf Of Josh McDonald
> > Sent: Tuesday, July 22, 2008 10:13 PM
> > To: [email protected]
> > Subject: Re: [flexcoders] Measurement and scrolling
> >
> >
> >
> > The only way to not have scrollbars over the content (or to only have
> > vertical, but not all the time) is to do scrollbar management yourself
> > rather than relying on Flex's inbuilt methods of handling it. This is a
> > decision made by the Flex team to avoid having to double measure() stuff
> > when adding scrollbars to a container.
> >
> > -Josh
> >
> > On Wed, Jul 23, 2008 at 3:02 PM, Richard Rodseth <[EMAIL PROTECTED]>
> wrote:
> >
> > Below is code for a scrolling container of one child - a highly
> > simplified version of the tiling container I've been wrestling with
> > off and on for way too long now. The component below sizes the
> > first/only child to fit within it, with some padding, but respects the
> > minimums of the child, adding scroll bars if necessary.
> >
> > I discovered this evening that setting measuredMinWidth/Height in the
> > measure() method was what was messing things up. With that removed,
> > this component (and the more complex tiler) behaves properly, except
> > that the scollbars are drawn over the right/bottom padding.
> >
> > What is the appropriate way to compensate for that? Adding a fudge
> > factor to the measured values, or removing it from the value passed to
> > setActualSize in UDL had no effect at all.
> >
> > Thanks, I'm *really* close now...
> >
> > - Richard
> >
> >
> >        public class MyContainer extends Container
> >        {
> >                private static const PADDING:Number = 10;
> >
> >                public function MyContainer()
> >                {
> >                        super();
> >                }
> >
> >
> >                override protected function measure():void
> >                {
> >                        var child:UIComponent = this.getChildren()[0] as
> > UIComponent;
> >
> >                        var childWidth:Number =
> > child.getExplicitOrMeasuredWidth();
> >                        var childHeight:Number =
> > child.getExplicitOrMeasuredHeight();
> >
> >                        measuredWidth = childWidth + 2 * PADDING ;
> >                        measuredHeight = childHeight + 2 * PADDING ;
> >                }
> >
> >
> >                override protected function
> > updateDisplayList(unscaledWidth:Number,
> > unscaledHeight:Number):void
> >                {
> >                super.updateDisplayList(unscaledWidth, unscaledHeight);
> >
> >                var child:UIComponent = this.getChildren()[0] as
> UIComponent;
> >
> >                        var newWidth:Number = Math.max(unscaledWidth - (2
> *
> > PADDING) ,
> > child.minWidth);
> >                        var newHeight:Number = Math.max(unscaledHeight -
> (2 *
> > PADDING) ,
> > child.minHeight);
> >
> >                child.setActualSize(newWidth, newHeight);
> >                child.move(PADDING, PADDING);
> >        }
> >        }
> > }
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> >        layout="absolute" minHeight="0" minWidth="0"
> >        verticalScrollPolicy="off" horizontalScrollPolicy="off"
> >        xmlns:comp="comp.*"
> >        >
> >
> >        <comp:MyContainer  width="95%" height="95%" borderStyle="solid"
> > horizontalScrollPolicy="auto" verticalScrollPolicy="auto">
> >                <mx:Button label="400x400" minWidth="400"
> minHeight="400"/>
> >        </comp:MyContainer>
> >
> > </mx:Application>
> >
> > ------------------------------------
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
> >
> >
> >
> >
> > --
> > "Therefore, send not to know For whom the bell tolls. It tolls for thee."
> >
> > :: Josh 'G-Funk' McDonald
> > :: 0437 221 380 :: [EMAIL PROTECTED]
> >
> >
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to