is it possible to make the child elements of a vbox to occupy 100% of the width without indicating width=100% for each element ?
views:
555answers:
3You could make the elements a custom component and specify width="100%" in the component. Otherwise, no.
You can also bind the width property to the parents width property, which would have much the same affect.
No... you'll have to add a width for each button. The vbox will ask the Button how much space it wants to take up. So you need to tell the button to try and take 100% of the width.
It shouldn't be a problem and is quite common to have width and height attributes on the majority of components, both functional and layout.
A VBox's layout algorithm will look at the children's width to decide how to lay them out. If you want to "automatically" set them to 100%, no matter what they are, then the way to do that is to trap when the child is added and set its percentWidth to 100 in the event handler, or else subclasses and loop over the children in a suitable overridden method e.g. createChildren
.