Thanks, Tim.  Knew there must be something, just couldn't find it.

I found this to be a good way to do it, as long as I'm not missing
something:

gr.validateSize(true);
var verticalGap:Number = grid.getStyle("verticalGap");
grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
    grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));

This seems more "right", though if you add some big numbers to height and
width it will always auto-calc them.  But I found if you add numbers that
are too small, you wind up with it chopped off a bit.

On Mon, Jun 15, 2009 at 10:08 PM, Tim Hoff <[email protected]> wrote:

>
>
> Hi Jason,
>
> Put this at the end of addCategory():
>
> myPopupButton.popUp.scrollRect =
> *new* Rectangle(0, 0, myPopupButton.popUp.width,
> myPopupButton.popUp.height + 30);
>
> Add an id:
>
> <PopUpButton id="myPopupButton" openAlways="true">
>
> This will trick the popup into redrawing.
>
> -TH
>
>
> --- In [email protected], Pan Troglodytes <chimpathe...@...>
> wrote:
> >
> > Okay, so given the following application:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <Application
> > xmlns="http://www.adobe.com/2006/mxml";
> > >
> > <Script>
> > <![CDATA[
> > private function addCategory():void
> > {
> > var gi:GridItem;
> > var gr:GridRow = new GridRow;
> >
> > gi = new GridItem;
> > (gi.addChild(new Label) as Label).text = "item " + (grid.numChildren
> > - 3) + ":";
> > gr.addChild(gi);
> >
> > gi = new GridItem;
> > (gi.addChild(new Label) as Label).text = "value";
> > gr.addChild(gi);
> >
> > grid.addChildAt(gr, grid.numChildren - 2);
> > }
> > ]]>
> > </Script>
> > <PopUpButton openAlways="true">
> > <popUp>
> > <Grid id="grid" paddingTop="4" paddingBottom="4" paddingLeft="4"
> > paddingRight="4"
> > fontSize="12" backgroundColor="0xFFFFFF" borderStyle="outset"
> > borderThickness="2"
> > >
> > <GridRow>
> > <GridItem colSpan="3">
> > <CheckBox label="Categorize data" fontWeight="bold"/>
> > </GridItem>
> > </GridRow>
> > <GridRow>
> > <GridItem>
> > <Label text="Start:"/>
> > </GridItem>
> > <GridItem>
> > <Label text="first row"/>
> > </GridItem>
> > </GridRow>
> > <GridRow id="lastRow">
> > <GridItem>
> > <Label text="End:"/>
> > </GridItem>
> > <GridItem>
> > <Label text="last row"/>
> > </GridItem>
> > </GridRow>
> > <GridRow>
> > <GridItem colSpan="3">
> > <Button label="Add Category" click="addCategory()"/>
> > </GridItem>
> > </GridRow>
> > </Grid>
> > </popUp>
> > </PopUpButton>
> > </Application>
> >
> > I want to be able to click the popupButton, click the "Add Category"
> button,
> > and have the popped up window resize right then so you can see
> everything.
> > Is there a good way (or even an ok way) to do this?
> >
> > --
> > Jason
> >
>  
>



-- 
Jason

Reply via email to