Friday, May 10, 2013

Re: When safe at startup to get element positions/dimensions?

Works ... thanks!    As to HeaderPanel... my HTML layout is working OK. I might have saved effort   by starting with a more widget-oriented layout, but those costs are now sunk.  

On Friday, May 10, 2013 10:55:31 AM UTC-7, Jens wrote:
Use 

Scheduler.get().scheduleDeferred(new ScheduledCommand() {
  void execute() {
        int topOfSpace = topSection.getAbsoluteBottom();
        int botOfSpace = botSection.getAbsoluteTop();
        int middleHeight = middleSection.getClientHeight();
        int topOfMiddle = topOfSpace + (botOfSpace - topOfSpace - middleHeight)/2;
        DOM.setStyleAttribute(DOM.getElementById("midSection"), "top", topOfBoard + "px");
  }
});

The code inside the command is delayed slightly, so it will be executed AFTER all your other JS code is done (so its kind of async) and the browser had some time to do its layout computations.

GWT's HeaderPanel widget (header + center + footer) does the same to recalculate the height of the center area. Maybe you can actually use it?

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate