I agree that I must add 'b' to a cell before a set the size. But my problem is that, it doesn't report error in host model, while it reports error in IE.
I use gwt 1.5.3. On 12月9日, 上午2时04分, "Ian Bambury" <ianbamb...@gmail.com> wrote: > You can't set the size of the cell that 'b' is in before you add 'b' to a > cell. > > > > > v.setCellWidth(b, "100px"); > > v.add(b); > > Ian > > http://examples.roughian.com > > 2008/12/8 wurenhai <wuren...@gmail.com> > > > > > > > Let's read the following code: > > ======CellPanel.java=== > > /** > > * Sets the height of the cell associated with the given widget, > > related to > > * the panel as a whole. > > * > > * @param w the widget whose cell height is to be set > > * @param height the cell's height, in CSS units > > */ > > public void setCellHeight(Widget w, String height) { > > Element td = DOM.getParent(w.getElement()); > > DOM.setElementProperty(td, "height", height); > > } > > > /** > > * Sets the horizontal alignment of the given widget within its > > cell. > > * > > * @param w the widget whose horizontal alignment is to be set > > * @param align the widget's horizontal alignment, as defined in > > * {...@link HasHorizontalAlignment}. > > */ > > public void setCellHorizontalAlignment(Widget w, > > HorizontalAlignmentConstant align) { > > Element td = getWidgetTd(w); > > if (td != null) { > > setCellHorizontalAlignment(td, align); > > } > > } > > > /** > > * Sets the vertical alignment of the given widget within its cell. > > * > > * @param w the widget whose vertical alignment is to be set > > * @param align the widget's vertical alignment, as defined in > > * {...@link HasVerticalAlignment}. > > */ > > public void setCellVerticalAlignment(Widget w, > > VerticalAlignmentConstant align) { > > Element td = getWidgetTd(w); > > if (td != null) { > > setCellVerticalAlignment(td, align); > > } > > } > > > /** > > * Sets the width of the cell associated with the given widget, > > related to the > > * panel as a whole. > > * > > * @param w the widget whose cell width is to be set > > * @param width the cell's width, in CSS units > > */ > > public void setCellWidth(Widget w, String width) { > > Element td = DOM.getParent(w.getElement()); > > DOM.setElementProperty(td, "width", width); > > } > > > ==== > > The method setCellSize is defferent from setCellAlign. > > I want to say that, there is a bug use setCellSize: > > VerticalPanel v = new VerticalPanel(); > > Button b = new Button("Button"); > > v.setCellWidth(b, "100px"); > > v.add(b); > > These codes are normal when i uesed in debug model, but there is a IE > > error after i comlie it. The "td" is null!- 隐藏被引用文字 - > > - 显示引用的文字 - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---