SWT 浏览器 - 禁用垂直滚动我如何隐藏它?

发布于 2024-09-11 04:40:17 字数 894 浏览 5 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乱了心跳 2024-09-18 04:40:17

我对 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.

2024-09-18 04:40:17

我也有同样的问题。 “overflow:hidden” CSS 样式没有帮助。
解决这个问题的唯一方法是使用一个丑陋的旧 body 属性:

<body scroll="auto">

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:

<body scroll="auto">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文