Re: OffsetWidth not including padding/margins

2011-12-05 Thread decitrig
It is?

UIObject API:
getOffsetWidth

public int *getOffsetWidth*()

Gets the object's offset width in pixels. This is the total width of the 
object, *including decorations such as border, margin, and padding.*

*Returns:*the object's offset width
Mozilla DOM docs:https://developer.mozilla.org/en/DOM/element.offsetWidth
"Typically, an element's offsetWidth is a measurement *which includes the 
element borders, the element horizontal padding*, the element vertical 
scrollbar (if present, if rendered) and the element CSS width."

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/hDQG3bXeY5gJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: OffsetWidth not including padding/margins

2011-12-05 Thread Paul Stockley
That's the expected behavior, check the DOM reference for 
OffsetWidth/OffsetHeight. 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/5XmkN-P-QpUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



OffsetWidth not including padding/margins

2011-12-05 Thread decitrig
I have a PopupPanel with a Label inside. I'm trying to center the popup 
horizontally, so I'm calling setPopupPositionAndShow. In the callback, 
however, the offsetWidth and offsetHeight arguments don't take into account 
any margins or padding, whether I set them on the popup or the label: the 
values are always for the text of the label only. Besides the arguments to 
the callback, I get the same (incorrect) results from calling 
getOffsetWidth/Height on the label or the popup directly. 
PopupPanel#center() also does not work correctly. Tested on both Chrome and 
Firefox.

Here's the code I'm using to set the position:
messageLabel.setText(message);
popup.setPopupPositionAndShow(new PositionCallback() {
  @Override
  public void setPosition(int offsetWidth, int offsetHeight) {
popup.setPopupPosition((Window.getClientWidth() - offsetWidth) / 2, 
popupTop);
  }
});

The PopupPanel is in a UiBinder; not sure if that's relevant. Am I doing 
something wrong, or should I file a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/OrHBZ_YgufcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.