Hi,

I want to perform a size calculation on a composite generated by
UiBinder, using UIObject.getOffsetWidth(). The composite's ui.xml
(simplified) looks like this:

         <ui:style>
                .test {
                        width: 80px;
                        height: 50px;
                }
        </ui:style>
        <g:HTMLPanel styleName="{style.test}">
        </g:HTMLPanel>

When I execute getOffsetWidth() during onModuleLoad(), the result is
987 (the same as the body's width in my case). That's quite
understandable: I assume, the CSS from the ui.xml isn't applied yet.

So I put getOffsetWidth() in a DeferredCommand, and now it returns 80,
which is correct.

But I'm a bit worried, that this may actually be a race condition: Can
I be sure, that the CSS will be fully loaded, before the
DeferredCommand gets its turn? Or is there a better place to put that
code?

Thanks
Chris

-- 
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-tool...@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.

Reply via email to