-
11 Feb 2010 8:38 AM #1
[FNR] CheckBox input / boxlabel alignment incorrect
[FNR] CheckBox input / boxlabel alignment incorrect
We were seeing very strange alignment issues with checkboxes in our application after migrating from GXT 2.0 to GXT 2.1.1.
In CheckBox.onResize(int,int), alignElements() is only called if boxLabel is null. I'm not sure what the reasoning is for this, but if I override onResize and always force it to alignElements(), the issues go away.
Simple runnable example:
You can see in the attached image that the checkbox is only properly aligned after the layout manager is executed for the "fixed" checkbox. The CheckBox.alignElements states that the input and label should be aligned to the vertical center of the element.Code:public class MyApp implements EntryPoint { public void onModuleLoad() { CheckBox c1 = new CheckBox(); c1.setBoxLabel("Misaligned GXT checkbox"); c1.setStyleAttribute("backgroundColor", "#ffffaa"); CheckBox c2 = new CheckBox() { @Override protected void onResize(int width, int height) { super.onResize(width, height); alignElements(); } }; c2.setBoxLabel("Fixed GXT checkbox"); c2.setStyleAttribute("backgroundColor", "#ffaaff"); LayoutContainer p = new LayoutContainer(new RowLayout()); p.add(c1, new RowData(1, 80)); p.add(c2, new RowData(1, 80)); RootPanel.get().add(p); } }
In our app, the behavior is even stranger. The label for the input is ~30px higher and ~20px further right than it should be. If I force alignElements() onResize(), it works perfectly fine.
-
8 Mar 2010 1:58 AM #2
This is fixed in SVN now as of revision 1951
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote