sometimes it's worth wrapping any repositioning up in a
DeferredCommand to give the browser a chance, i.e. take you code that
does something like this:

int x = X.getAbsoluteTop;
int h = X.getOffsetHeight();
W.setWidgetPostition(x,y);
W.setWidth(h/2+"px");

and make it

DeferredCommand.addCommand(new Command(){
   public void execute(){
      int x = X.getAbsoluteTop;
      int h = X.getOffsetHeight();
      W.setWidgetPostition(x,y);
      W.setWidth(h/2+"px");
   }
});

now the positioning code will execute a little later giving the
browser chance to have redrawn everything and you should get more
consistent answers.

//Adam

On 2 Maj, 01:12, Stephen Cagle <[email protected]> wrote:
> I have a Composite widget within which I have overridden the onResize
> () method. Some of the element widgets of this widget position
> themselves relative to other widgets. That is to say, I sometimes
> position widget X using .getAbsoluteTop() and .getOffsetHeight().
> Unfortunately, sometimes .getAbsoluteTop sometimes returns a pretty
> random value. I think this is because I am re-populating/creating a
> lot of the widgets upon resize. So maybe I am getting the size of the
> widget "as it is being built". What should I do to deal with this. I
> need to position things absolutely relative to other widgets, but
> within the onResize() method, I am getting (occasionally) odd results?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to