SWT 浏览器 - 禁用垂直滚动我如何隐藏它?
我有一个 SWT shell,其中有一个 SWT 浏览器。在 OSX 上它工作正常,但在 Windows 上它坚持在 shell 或浏览器中放置禁用的垂直滚动条(我不知道是哪个!)。有没有办法强制小部件隐藏滚动条?
当我在 shell 或浏览器上调用 getVerticalScrollBar() 或水平等效项时,我得到 null。那么有没有办法完全删除滚动条呢?
这是我的代码,没什么特别的:
this.shell = new Shell(this.display, SWT.CLOSE | SWT.MIN | SWT.MAX);
shell.addListener(SWT.Close, new Listener(){
public void handleEvent(Event event) {
event.doit = false;
location = shell.getLocation();
shell.setVisible(false);
}
});
shell.setSize(popUpSize);
shell.setMinimumSize(popUpSize);
if(this.location == null){
shell.setLocation(x, y);
}else{
shell.setLocation(this.location);
}
shell.setLayout(new FillLayout());
this.browser = new Browser(shell, SWT.NONE | SWT.SMOOTH);
有什么想法吗?
干杯
安迪
I have a SWT shell, with an SWT browser in it. on OSX it works fine, but when on Windows it insists on putting a disabled vertical scrollbar in the shell or browser (i don't know which!). Is there a way of forcing the widgets to hide their scroll bars?
When i call getVerticalScrollBar() or the horizontal equivilant on either the shell or the browser i get null. So is there a way of removing the scrollbars completley?
here is my code, nothing special:
this.shell = new Shell(this.display, SWT.CLOSE | SWT.MIN | SWT.MAX);
shell.addListener(SWT.Close, new Listener(){
public void handleEvent(Event event) {
event.doit = false;
location = shell.getLocation();
shell.setVisible(false);
}
});
shell.setSize(popUpSize);
shell.setMinimumSize(popUpSize);
if(this.location == null){
shell.setLocation(x, y);
}else{
shell.setLocation(this.location);
}
shell.setLayout(new FillLayout());
this.browser = new Browser(shell, SWT.NONE | SWT.SMOOTH);
Any ideas?
Cheers
Andy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对 SWT 浏览器对象也有类似的问题。我最终在 HTML 页面中使用了“overflow:hidden”CSS 样式,该样式告诉浏览器抑制滚动条,并在页面太大而无法容纳时将网页裁剪在浏览器窗口的边缘。
I had a similar problem with SWT browser objects. I ended up using the "overflow:hidden" CSS style in my HTML page, which tells the browser to suppress scrollbars and clip the webpage at the edge of the browser window if the page is too big to fit.
我也有同样的问题。 “overflow:hidden” CSS 样式没有帮助。
解决这个问题的唯一方法是使用一个丑陋的旧 body 属性:
I had the same problem. "overflow:hidden" CSS style didn't help.
The only way to do the trick was using an ugly old body attribute: