Centering item renderers in a HorizontalList - apache-flex

I am trying to center itemRenderers in a horizontal list if the number of items in the list is less than the maximum visible number. Has anyone found a good way to do this?
See an illustration of what I mean if it is hard to picture.
Thanks!

Override the measure() method - I've writen a blog entry here: http://flexmonkey.blogspot.com/2010/05/centre-aligned-horizontallist-in-flex.html
simon

One solution that comes to mind would be to add invisible renderers to achieve the same centering.

You might want to consider using a horizontal box or "Hbox" instead of a horizontal list component. This will allow you to use the horizontal align property to set center. If not, simply extend the horizontal list component to accept a center align property, and copy it from the hbox to your new extended component.

Would paddingRight or paddingLeft accomplish what you're looking for? If you combine it with setting the columnWidth and the columnCount, that would allow you to adjust where the items first appear.

Related

QTreeWidget that contains widgets and set row height issue

Setting row height is more or less trivial via inherit from QItemDelegate.
The problem is that I can make the row size bigger but I cannot make it smaller if I add a widget inside.
Any tip on this?
Thank you in advance.
Maybe your widget QWidget::minimumSize().height() is bigger than you want to set in your row height?
Also, maybe you will post some related code?

What Cell,Table can I use to create a grid of only images in every cell, in GWT?

I need to create a GWT application that handle the buying of films. So I have to show in a grid (not in a list, I don't like the view) these cell containing image and info about the film like this:( http://static.ipaditalia.com/wp-content/uploads/2012/11/mzl.sckskoqz.480x480-75.jpg ). I think that I need of a grid showing I think, to obtain something like but I wouldn't know to start. thanks for help!
You can use a simple FlowPanel as a container, and add each image with a float set to "left".
Alternatively, you can use a flex-box model with flex-flow: row wrap on a container.
You don't need any widgets for this. This is simple CSS, and it will give you the best performance and the smallest code size.

QBoxLayout with stretchable separator

do anybody know how to create a stretchable separator between two Widgets in a QBoyLayout?
So that the user can easily change the stretch factor for the cols/rows.
Something like that you can see in the picture:
thanks.
I think a QSplitter would fit best for your need. You can click and drag it to adjust how much space each widget gets.
What you are looking for is a Splitter Layout:
Another common way to manage the layout of objects on a form is to
place them in a splitter. These splitters arrange the objects
horizontally or vertically in the same way as normal layouts, but also
allow the user to adjust the amount of space allocated to each object.

Removing the Scrollbar from Horizontal List

I've got an Horizontal List. It contains 6 XML Nodes at the moment. But what I'd like to do is remove the scrollbar so that an button can function to scroll through the nodes instead.
Has anyone achieved this, if so how did you go about it?
Thanks in advance
You can usually remove the scroll bar by setting the horizontalScrollPolicy or verticalScrollPolicy to off.
After that, I believe you can scroll the list by setting the verticalScrollPosition or horizontalScrollPosition

Different vertical gaps between siblings in the same mx:Tree control

Does anyone know of a way to specify different vertical gaps between siblings in a Tree? I want to child nodes spaced tighter together (maybe 10px) while the top level parents remain spaced further apart (20px). Essentially, I need to change the gap dynamically based upon the depth of the node, but I'm not sure if the Tree class (or the List class, which Tree extends) offers this type of functionality. Any ideas? Thanks in advance.
Can you use an itemRenderer and add spacing to the itemRenderer based on the data sent in?
I would try setting the padding to the minimum you want, then add <mx:Spacer ... /> with whatever additional height/ width you want to add between the children where desired.

Resources