0
votes

I'm working on a Flex 4 combo box which has a Tree ItemRenderer, and I want to set the height for this combo box programmatically based on data (i.e: based on xml data).

Thank to Peter deHaan at http://blog.flexexamples.com/2008/07/04/creating-a-variable-row-height-item-renderer-on-a-combobox-control-in-flex/, I can set height for Tree ItemRenderer and Combo box in normal case, but when horizontal scroll bar is shown, the layout will be not good. (I have to set horizontalScrollPolicy to 'auto' because as Tree ItemRenderer can be expanded when XML data having multiple level.)

My question is: how to know whether horizontal scroll bar of Combo box is shown or not?

1
Its been a while since Ive been in Flex but the hard solution seems to be to measure the visible items, then compare to the container width. The cheat that occurs to me is this: See if you can set scroll-x (whatever) to 1 and then without a scrollbar hopefully it will remain 0 and with a scrollbar it will be 1; - Mark Robbins

1 Answers

0
votes

I am not sure if I got your solution correctly, but from what I understood, you need a container, which will resize according to the required height and not have scroll-bars.

If I am correct, you can use the flowBox container, used with the flexlib library.

http://flexlib.googlecode.com/svn/trunk/docs/flexlib/containers/FlowBox.html

Please feel free to correct me if I understood the question incorrectly.