Hi Chris, I dont think, that the css is not applied yet, rather the whole uibinder isnt applied, yet. However, you did not show us the full code.
I usally put elements in a certain environment to measure its real size (inclunding border, padding, margin). I always get immediate results. Stefan Bachert http://gwtworld.de On 6 Jun., 21:58, Chris Lercher <cl_for_mail...@gmx.net> wrote: > 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.