Hello,
I have a container (let's say a HLayout) and any Canvas (let's say a Button). I want to center the Button horizontally and vertically in the container. How can I accomplish this?
I've tried several combinations of setting the layoutAlign() of both the container and the button, but to no avail.
Is there a manual or tutorial on how to properly use the following elements:
VerticalAlignment, Alignment, setAlign(), setLayoutAlign()?
Unfortunately, the javadoc is not sufficient for me. For instance, it says for Layout.setAlign():
However, the following code:
Does NOT align the layout members horizontally centered as expected. In fact, nothing happens.
setLeft() and setTop() are useless for me because these methods only accept pixel values (in original CSS, it's also possible to specify percentage values, e.g. left: 50%; and top: 50%; center an element in its container, but I think it won't work in SmartGWT since it calculates with pixel values only?)
Any help would be greatly appreciated.
I have a container (let's say a HLayout) and any Canvas (let's say a Button). I want to center the Button horizontally and vertically in the container. How can I accomplish this?
I've tried several combinations of setting the layoutAlign() of both the container and the button, but to no avail.
Is there a manual or tutorial on how to properly use the following elements:
VerticalAlignment, Alignment, setAlign(), setLayoutAlign()?
Unfortunately, the javadoc is not sufficient for me. For instance, it says for Layout.setAlign():
Code:
Alignment of all members in this Layout on the length axis. Defaults to "top" for vertical Layouts, and "left" for horizontal Layouts.
Code:
testHLayout.setAlign(Alignment.CENTER)
setLeft() and setTop() are useless for me because these methods only accept pixel values (in original CSS, it's also possible to specify percentage values, e.g. left: 50%; and top: 50%; center an element in its container, but I think it won't work in SmartGWT since it calculates with pixel values only?)
Any help would be greatly appreciated.
Comment