public void onModuleLoad() { DockLayoutPanel dock = new DockLayoutPanel(Unit.PX); SimplePanel west = new SimplePanel(); final SimplePanel main = new SimplePanel(); SimplePanel east = new SimplePanel();
dock.addWest(west, 350); dock.addEast(east, 200); dock.add(main); RootLayoutPanel.get().add(dock); Window.alert("Width: " + main.getOffsetWidth()); Timer timer = new Timer() { @Override public void run() { Window.alert("Width: " + main.getOffsetWidth()); } }; timer.schedule(1); } On Apr 16, 12:52 pm, Sky <myonceinalifet...@gmail.com> wrote: > Calling getOffsetWidth() on a widget within a LayoutPanel during > onModuleLoad() always returns 0. After onModuleLoad() has completed > then it returns a meaningful answer. > > See my code below to reproduce this situation. The first Alert > displays a value of "0" while the second Alert displays "1280" (since > my screen's width is 1680). > > Does anyone know a way to find out what the width of a widget will be > before onModuleLoad() completes? There must be some CSS we can apply > so that the absolutely positioned container will know it's width. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors