event for detecting DOM.createElement() is completed

3 views
Skip to first unread message

bhomass

unread,
Nov 23, 2009, 9:37:01 PM11/23/09
to Google Web Toolkit
I need to know when a widget is finished rendering in order to adjust
its size. I see a javascript method
element.addEventListener(eventType, handler, capture);

can someone tell me what eventType I can use to detect the completion
of DOM.createElement()?

Thomas Broyer

unread,
Nov 24, 2009, 4:40:39 AM11/24/09
to Google Web Toolkit
createElement is synchronous/blocking; it doesn't return before
completion, so there's no need for an event.
You might need to attach the widget (or at least its element) to the
document though to have its size computed so you can later adjust it.

bhomass

unread,
Nov 24, 2009, 8:09:27 PM11/24/09
to Google Web Toolkit

> createElement is synchronous/blocking; it doesn't return before
> completion, so there's no need for an event.
> You might need to attach the widget (or at least its element) to the
> document though to have its size computed so you can later adjust it.

I attached the new Element to its container using appendChild
(newElement) and checked for its height right afterwards, but the
height is always 0. I used
newElement.getClientHeight(), is that correct?

does the layout happen right after the appendChild()? or is there a
way to detect when the layout is completed?

Reply all
Reply to author
Forward
0 new messages