SmartGWT Canvas宽度问题
我在初始页面上显示整个 SmartGWT Canvas 时遇到问题。我已经剥离了所有内容,留下了一个非常基本的入口点来说明我的问题。当我创建一个 Canvas 并将其添加到根面板时,我的浏览器中会出现一个水平滚动条。谁能解释为什么以及我可以做什么来将画布调整为窗口的宽度?
提前致谢。
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 );
}
}
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 );
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在哪个浏览器和哪个版本中发生它。您的代码在我的系统中工作,没有滚动条。并且在 smartgwt 中,无需将画布添加到 RootPanel。只需调用 view.draw() 。它将在屏幕上呈现。
还要验证您的 html 正文宽度。
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.
请尝试 view.draw() 而不是 RootPanel.get().add( view ) 并看看是否有帮助。当在顶级容器 Canvas (或子类)上调用 draw() 时,智能 GWT 用户会延迟渲染组件,这些组件会级联到其子 Canvas。这比将单个组件附加到浏览器 DOM 更有效。
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.