문제

I am making a slider based component in GWT.

Parent : width = 100%
.-------------------------------------------------.
| .---------------------------------------------. |
| |     Child : width = X                       | |
| '---------------------------------------------' |
'-------------------------------------------------'

where X = (parent's width in px) - (some calculations based on runtime);

My code says:

int providedWidth = parentContainer.getOffsetWidth();

In Firefox, I get the width correctly as (say) 345px But in IE6, it constantly returns the width as 0 no matter what size it is.

From GWT perspective, Parent is an AbsolutePanel placed within a DockPanel (super parent), Child is a a HorizontalPanel.

I haven't placed code here for brevity, is there any other way to get the width or am I doing something wrong ?

도움이 되었습니까?

해결책

Just a wild guess, but maybe the element needs "layout" in IE6? Can you give it style='zoom:1'?

다른 팁

In IE you sometimes have to get the size information in a DeferredCommand because IE only does the layout after the event thread is done.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top