cheerq / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

FlowBox Height problem #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I need a FlowBox ( the Height is can auto change )

is flexlib.containers.FlowBox can auto change Height ? 

Original issue reported on code.google.com by duomis...@gmail.com on 11 Aug 2008 at 10:50

GoogleCodeExporter commented 8 years ago
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.

Original comment by nbi...@gmail.com on 9 Oct 2008 at 2:46

GoogleCodeExporter commented 8 years ago
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;
}

Original comment by nbi...@gmail.com on 9 Oct 2008 at 2:57

GoogleCodeExporter commented 8 years ago
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.

Original comment by jacob.my...@gmail.com on 15 Dec 2008 at 3:08

GoogleCodeExporter commented 8 years ago

Original comment by dmcc...@gmail.com on 8 Jan 2009 at 5:50

GoogleCodeExporter commented 8 years ago
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.

Original comment by samuel....@gmail.com on 18 Feb 2009 at 5:48

GoogleCodeExporter commented 8 years ago
Hello,

When do you plan to integrate the fix and release a new version of the lib ?

Original comment by xcou...@gmail.com on 25 Mar 2009 at 4:43

GoogleCodeExporter commented 8 years ago
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.

Original comment by anthony....@gmail.com on 9 Apr 2009 at 9:37

GoogleCodeExporter commented 8 years ago
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;
    }
}

Original comment by eltonj...@gmail.com on 29 May 2009 at 3:53

GoogleCodeExporter commented 8 years ago
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

Original comment by gruts...@gmail.com on 24 Jul 2009 at 12:40

GoogleCodeExporter commented 8 years ago
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.

Original comment by eltonj...@gmail.com on 26 Jul 2009 at 2:54