Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
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 timh...@aol.com 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 flexcoders@yahoogroups.com, 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=0xFF 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
[flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
Yep, that looks great. I thought about all of that, but knew that you'd tweak it to get what you needed. Glad that I could finally help you out with something Jason. -TH --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: 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 timh...@... 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 flexcoders@yahoogroups.com, Pan Troglodytes chimpathetic@ 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=0xFF 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
Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
C'mon, Tim, your posts help me loads of times and you don't even realize it. My #1 place to go for searching for answers to tough problems is my flexcoders archive and your name pops up a lot with the answer! And RowColorDataGrid was a lifesaver. Okay, back to the topic. Just realized that there's a little something missing. If you have the popupButton on the bottom of the window so that it causes the popup to appear ABOVE it, then the code above glitches in that it makes the window grow down and cover the popupbutton. Here's a fix: 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)); if (grid.y myPopupButton.y) grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); To see this in action in the above example, set the application layout=absolute and the myPopupButton bottom=0. Of course, when you add so many categories that it gets taller than the window its in, then you're screwed! You'd have to implement your own don't grow when bigger than this and turn on scrollbars instead logic. Luckily I don't need that right now. On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@aol.com wrote: Yep, that looks great. I thought about all of that, but knew that you'd tweak it to get what you needed. Glad that I could finally help you out with something Jason. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: 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 timh...@... 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 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ 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=0xFF 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 -- Jason
Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
I should know better by now to never declare victory until you tried your test app solution in your REAL app. A problem occured that if your popupbutton is embedded in another control, the y value will no longer be in the same frame of reference as the popup, which is no a child of the same control as the popupbutton. So this may not be the BEST way to do it, but it works: 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)); if (grid.localToGlobal(new Point(0, 0)).y grid.owner.localToGlobal(new Point(0, 0)).y) grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); On Tue, Jun 16, 2009 at 10:38 AM, Pan Troglodytes chimpathe...@gmail.comwrote: C'mon, Tim, your posts help me loads of times and you don't even realize it. My #1 place to go for searching for answers to tough problems is my flexcoders archive and your name pops up a lot with the answer! And RowColorDataGrid was a lifesaver. Okay, back to the topic. Just realized that there's a little something missing. If you have the popupButton on the bottom of the window so that it causes the popup to appear ABOVE it, then the code above glitches in that it makes the window grow down and cover the popupbutton. Here's a fix: 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)); if (grid.y myPopupButton.y) grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); To see this in action in the above example, set the application layout=absolute and the myPopupButton bottom=0. Of course, when you add so many categories that it gets taller than the window its in, then you're screwed! You'd have to implement your own don't grow when bigger than this and turn on scrollbars instead logic. Luckily I don't need that right now. On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@aol.com wrote: Yep, that looks great. I thought about all of that, but knew that you'd tweak it to get what you needed. Glad that I could finally help you out with something Jason. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: 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 timh...@... 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 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ 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=0xFF 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
[flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
Ha, what I meant is that years ago, you helped me with a problem that I was having with RowColorDataGrid and I was also able to use a tree with connector lines that you created. Just glad to return the favor. :) -TH --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: C'mon, Tim, your posts help me loads of times and you don't even realize it. My #1 place to go for searching for answers to tough problems is my flexcoders archive and your name pops up a lot with the answer! And RowColorDataGrid was a lifesaver. Okay, back to the topic. Just realized that there's a little something missing. If you have the popupButton on the bottom of the window so that it causes the popup to appear ABOVE it, then the code above glitches in that it makes the window grow down and cover the popupbutton. Here's a fix: 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)); if (grid.y myPopupButton.y) grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); To see this in action in the above example, set the application layout=absolute and the myPopupButton bottom=0. Of course, when you add so many categories that it gets taller than the window its in, then you're screwed! You'd have to implement your own don't grow when bigger than this and turn on scrollbars instead logic. Luckily I don't need that right now. On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@... wrote: Yep, that looks great. I thought about all of that, but knew that you'd tweak it to get what you needed. Glad that I could finally help you out with something Jason. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ wrote: 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 TimHoff@ 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 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ 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=0xFF 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 -- Jason
Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
Yet another correction: grid.scrollRect = new Rectangle(0, 0, Math.max(grid.width, gr.measuredWidth), grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap)); Didn't make sense to add the width in this example. I thought you were referring to the last couple of threads of mine you've posted on. :D But yes, I do remember that old post. Can't believe it was years ago! Where does the time go? Oh, that's right, the bugs in my program eat most of it! On Tue, Jun 16, 2009 at 11:08 AM, Tim Hoff timh...@aol.com wrote: Ha, what I meant is that years ago, you helped me with a problem that I was having with RowColorDataGrid and I was also able to use a tree with connector lines that you created. Just glad to return the favor. :) -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: C'mon, Tim, your posts help me loads of times and you don't even realize it. My #1 place to go for searching for answers to tough problems is my flexcoders archive and your name pops up a lot with the answer! And RowColorDataGrid was a lifesaver. Okay, back to the topic. Just realized that there's a little something missing. If you have the popupButton on the bottom of the window so that it causes the popup to appear ABOVE it, then the code above glitches in that it makes the window grow down and cover the popupbutton. Here's a fix: 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)); if (grid.y myPopupButton.y) grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); To see this in action in the above example, set the application layout=absolute and the myPopupButton bottom=0. Of course, when you add so many categories that it gets taller than the window its in, then you're screwed! You'd have to implement your own don't grow when bigger than this and turn on scrollbars instead logic. Luckily I don't need that right now. On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@... wrote: Yep, that looks great. I thought about all of that, but knew that you'd tweak it to get what you needed. Glad that I could finally help you out with something Jason. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Pan Troglodytes chimpathetic@ wrote: 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 TimHoff@ 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 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ 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=0xFF 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:/
[flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
I'm glad that you're posting these corrections, cause I'm keeping this solution for future reference. ;) btw, I'm still using your tree in a little source code explorer app that I made (bugs and all) :P http://www.timothyhoff.com/projects/googlemate/srcView/GoogleMateSourceC\ odeExplorer.html http://www.timothyhoff.com/projects/googlemate/srcView/GoogleMateSource\ CodeExplorer.html -TH --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@... wrote: Yet another correction: grid.scrollRect = new Rectangle(0, 0, Math.max(grid.width, gr.measuredWidth), grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap)); Didn't make sense to add the width in this example. I thought you were referring to the last couple of threads of mine you've posted on. :D But yes, I do remember that old post. Can't believe it was years ago! Where does the time go? Oh, that's right, the bugs in my program eat most of it! On Tue, Jun 16, 2009 at 11:08 AM, Tim Hoff timh...@... wrote: Ha, what I meant is that years ago, you helped me with a problem that I was having with RowColorDataGrid and I was also able to use a tree with connector lines that you created. Just glad to return the favor. :) -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ wrote: C'mon, Tim, your posts help me loads of times and you don't even realize it. My #1 place to go for searching for answers to tough problems is my flexcoders archive and your name pops up a lot with the answer! And RowColorDataGrid was a lifesaver. Okay, back to the topic. Just realized that there's a little something missing. If you have the popupButton on the bottom of the window so that it causes the popup to appear ABOVE it, then the code above glitches in that it makes the window grow down and cover the popupbutton. Here's a fix: 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)); if (grid.y myPopupButton.y) grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap); To see this in action in the above example, set the application layout=absolute and the myPopupButton bottom=0. Of course, when you add so many categories that it gets taller than the window its in, then you're screwed! You'd have to implement your own don't grow when bigger than this and turn on scrollbars instead logic. Luckily I don't need that right now. On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff TimHoff@ wrote: Yep, that looks great. I thought about all of that, but knew that you'd tweak it to get what you needed. Glad that I could finally help you out with something Jason. -TH --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Pan Troglodytes chimpathetic@ wrote: 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 TimHoff@ 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 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com, Pan Troglodytes chimpathetic@ 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 -
[flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?
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 flexcoders@yahoogroups.com, 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=0xFF 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