Thanks, that pretty much works
the only strange behavior is the when I first launch the application
in hosted mode, the event doesn't appear to fire before the widget's
getOffsetHeight is > 0. But as soon as I refresh in hosted mode it
works fine.
And if I compile/browse and trying in IE6/Firefox/Chrome everything
works as expected.
So to ensure it works in hosted mode *every* time I added the
following deferred command to the Widget's constructor, in addition to
onLoad --
DeferredCommand.addCommand(new Command(){
@Override
public void execute() {
if(GWT.isScript()) {
... do calculation ...
}
}
});
I don't really like having to use a hack, but I need it to work in
hosted mode since people are using my widget library and i don't want
them to think something is broken.
Is there a better way than using this deferred command?
On Jul 30, 1:38 pm, Adam T <[email protected]> wrote:
> try the onLoad() method:
>
> /**
> * This method is called immediately after a widget becomes attached
> to the
> * browser's document.
> */
> protected void onLoad() {
> }
>
> //Adam
>
> On 30 Juli, 22:10, bradr <[email protected]> wrote:
>
>
>
> > I'm working on a widget and need to do calculations based on it's
> > height in order to layout its child components. So i do something like
> > this:
>
> > @Override
> > public void setHeight(String height) {
>
> > super.setHeight(height);
> > ...do height calculations
>
> > }
>
> > The problem i'm having is that setHeight is called before the widget
> > is visible on the screen, and therefore, I can't do the calculation
> > because getOffsetHeight is equal to zero.
>
> > Is there a method I can override or an event I can subscribe to that
> > tells me when the widget is visible and has been laid out on the
> > screen, at which point i could run the calculation?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---