When you call DeckLayoutPanel.setWidget(w) the DeckLayoutPanel schedules a layout command which will be executed after all of your code has been executed and just before the browser takes back control (see: Scheduler.get().scheduleFinally()). I think this has been done because you could call DeckLayoutPanel.setWidget() multiple times in your code, but when your code is done, the necessary DOM operations will be executed only once.
You can force the DOM operations by calling DeckLayoutPanel.forceLayout() just after you have called DeckLayoutPanel.setWidget() and then try to do your calculations. But I am not quite sure if its enough. If not, your best bet is to defer your calculations until everything has been rendered by the browser:
final Panel p = ...
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
public void run() {
p.getOffsetHeight() ... //calculate your stuff
}
});
Using a deferred command should definitely work.
-- 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/-/OdIl5VrlkJMJ.
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