views:

486

answers:

2

I am having problems with showing my entire SmartGWT Canvas on my initial page. I've stripped everything out and am left with an extremely basic EntryPoint to illustrate my issue. When I just create a Canvas and add it to the root panel, I get a horizontal scrollbar in my browser. Can anyone explain why and what I can do to have the Canvas sized to the width of the window?

Thanks in advance.

public class TestModule implements EntryPoint
    {
    protected Canvas           view      = null;
    /**
     * This is the entry point method.
     */
    public void onModuleLoad()
    {
        view = new Canvas();
        view.setWidth100();
        view.setHeight100();
        view.setShowEdges( true );
        RootPanel.get().add( view );
    }
}
+1  A: 

In which browser and which version it is happening.Your code is working in my system without scroll bar.And In smartgwt no need to add the canvas to RootPanel.Just call view.draw() .It will render in the screen.

Verify your html body width also.

BlackPanther
Sorry, should have specified that this is GWT 2.0.2 and SmartGWT 2.1. My html body has no width specified and was happening in both Firefox and IE8. That said, changing it to do the draw on the canvas instead of adding it to the root panel solved the issue. Thanks!
Doug
A: 

Please try view.draw() instead of RootPanel.get().add( view ) and see if that helps. Smart GWT users lazy rendering of components which cascade to its children Canvases when draw() is called on the top level container Canvas (or subclass). This is far more efficient than attaching individual components to the browser DOM.

Sanjiv Jivan