want to set the width of a button so that it fits exactly into its
parent, a FlowPanel in this case.
I have tried to retrieve the parent's client width and subtracted a
lot of numbers, including margin, padding, border, but the button is
always too wide, causing horiziontal scrollbars to appear.
Here is what I have done:
public void onResize()
{
Element e = getElement();
Style s = e.getStyle ();
int b = getInteger (s.getBorderWidth());
int ml = getInteger (s.getMarginLeft());
int mr = getInteger (s.getMarginRight());
int pl = getInteger (s.getPaddingLeft());
int pr = getInteger (s.getPaddingRight());
int pxs = e.getClientWidth() - ml - mr - pl - pr - 2 * b;
myButton.setWidth(pxs + "px");
}
Please help!
Thanks!
Magnus
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment