On 27 mai, 06:43, spierce7 <[email protected]> wrote:
> Hey guys, I'm creating a class that extends Label, and for some reason
> whenever I create an instance of it, it doesn't load the onLoad()
> class when it's instantiated. I've got it set up the exact same way I
> have a class that extends grid, that properly uses onLoad, but for
> some reason this isn't.
>
> The idea occurred to me that I don't even really know what onLoad does
> exactly. What is the difference between onLoad and a constructor, and
> how should I be using them differently? (yes I did a search).

>From the JavaDoc: "This method is called immediately after a widget
becomes attached to the browser's document."
This is has nothing to do with the time you create the widget (you can
create a widget and just keep it in a variable, and add it to another
widget later, or never; this is not really a good practice but it's
possible); it can be called at different times:
 - when you add the widget to another widget which is already attached
to the browser's document
 - when you attach a parent widget to the browser's document (onLoad
propagates to children)
Widgets that are "attached" without the need to add them to other
widgets are:
 - RootPanel
 - RootLayoutPanel
 - any widget that you created using its wrap(Element) static method

> Out of curiosity how does onModuleLoad() fit into the mix also?

Again totally a different thing. This is called to "start" our app.
Nothing will ever be called before onModuleLoad (except the
constructor of your EntryPoint class, of course)

-- 
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