I bet this has been asked before. How do I align a canvas that is a member of a VLayout in the middle of the VLayout along its horizontal axis? I tried using .setAlign and .setLayoutAlign. What works?
All the properties you’re trying link to the same example - take a look.
So, i looked at the example. the only thing I dont have that the example has is .setWidth100() on the container layout. i still cant seem to get it! this is teh code from the example:
# // 1. HLayout with layout.align = 'center'
# //
# // This centers the members along the horizontal axis of the HLayout.
# // Note that the members have a specified width that is less than the
# // width of the HLayout -- otherwise, you would not see the centering
# // visually!
# final HLayout hLayoutAlignCenter = new HLayout();
# // Specifying the width creates space within which to center the members.
# hLayoutAlignCenter.setWidth100();
# hLayoutAlignCenter.setHeight100();
# hLayoutAlignCenter.setLayoutMargin(6);
# hLayoutAlignCenter.setMembersMargin(6);
# hLayoutAlignCenter.setBorder("1px dashed blue");
# hLayoutAlignCenter.setAlign(Alignment.CENTER); // As promised!
Hey,
Next time, try using the forum search.
http://www.smartclient.com/smartgwt/showcase/#layout_center_align
cheers