Saturday, May 26, 2012

Re: LayoutPanel holding ResizeComposite widgets showing odd behavior

If I remember correctly, whenever you call setWidgetLeftWidth() or any of the other layout methods, the LayoutPanel will call animate(0); internally. This schedules a LayoutCommand using Scheduler.get().scheduleFinally() which means the layout change happens after all of your code in the current event loop has done its work. 
Its implemented that way for performance: Inside the current event loop you can call as many layout methods as you like and the layout is done all at once in a finally command and not after every layout method call. If you need the changes to take effect immediately you have to call LayoutPanel.forceLayout().
Also sometimes you just need a Scheduler.get().scheduleDeferred() command to read changed width/height values because the browser needs some time to re-render your widget. Only when its re-rendered the browser can give you the new, correct width/height values. So if you ever see strange width/height values, try a scheduleDeferred.

-- J.

--
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/-/mM0my1owH6kJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment