Hi,

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to