Open nicoulaj opened 13 years ago
Updated by nbi...@gmail.com on 2008-10-09T02:46:44
I need this as well. A FlowBox seems to report its height to be what it would be if all elements were stacked vertically. This is strange behaviour.
Updated by nbi...@gmail.com on 2008-10-09T02:57:17
I haven't tested this much, but the fix seems to be simple. In the FlowLayout class near the end, change the following: if (!moveChildren) { target.measuredHeight = currentRowY + currentRowHeight + vm.bottom + vm.top; } TO: if (moveChildren) { target.measuredHeight = currentRowY + currentRowHeight + vm.bottom + vm.top; target.height = target.measuredHeight; }
Updated by jacob.my...@gmail.com on 2008-12-15T15:08:05
I can confirm, without extensive testing for other things, that the proposed solution by nbilyk does get the FlowBox component to behave properly, or at least properly where it was failing before.
Many thanks for the simple and quick fix, hopefully flexlib will get this taken care of in the next revision or so.
Updated by dmcc...@gmail.com on 2009-01-08T17:50:17
Added label FlexLib-FlowBox Added label PotentialFix
Updated by samuel....@gmail.com on 2009-02-18T05:48:36
I can also confirm that the change proposed by nbilyk also works when it didn't before. Also works when panel is being resized such that the number of rows changes.
Thanks for the fix nbilyk.
Updated by xcou...@gmail.com on 2009-03-25T16:43:51
Hello,
When do you plan to integrate the fix and release a new version of the lib ?
Updated by anthony....@gmail.com on 2009-04-09T21:37:10
The above fix "partially" addresses the issue. The FlowBox now has the correct height. However, it's preferred height (set by the "measure" method still produces a height that is usually too tall, since it is using the BoxLayout vertical method which add the height of each child, whether stacked, or not.
Updated by eltonj...@gmail.com on 2009-05-29T03:53:33
Another solution is to register the following handler for updateComplete event on FlowBox:
private function flowBox_updateCompleteHandler(event:Event):void { var fb:FlowBox = event.target as FlowBox; if(fb.numChildren > 0) { var lastChild:DisplayObject = fb.getChildAt(fb.numChildren - 1); fb.height = lastChild.y + lastChild.height + fb.viewMetrics.bottom; } else { fb.height = fb.viewMetrics.top + fb.viewMetrics.bottom; } }
Updated by gruts...@gmail.com on 2009-07-24T12:40:43
I had to change this (maybe it's specific to my design) this.height = lastChild.y + lastChild.height + this.viewMetrics.bottom + this.getStyle("paddingTop") + 1; To set the exact height
Updated by eltonj...@gmail.com on 2009-07-26T14:54:03
Another case that needs to be handled is when the children in the last row are of variable height and lastChild is not the tallest. You will need to iterate through all the children and for those children that have max Y you must find the max height and use that value in the above functions.
Originally filed by duomis...@gmail.com on 2008-08-11T10:50:59
I need a FlowBox ( the Height is can auto change )
is flexlib.containers.FlowBox can auto change Height ?