Thanks!
On Jun 7, 8:27 pm, kozura <[email protected]> wrote: > Yes, this is fine and there is no race condition; I do this all the > time. The deferred command is guaranteed to run after all other > processing of the current event stack is completed, which includes all > rendering that determines final sizing. > > On Jun 6, 1:58 pm, Chris Lercher <[email protected]> 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 [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.
