SWT独立滚动条小部件 [英] SWT standalone scrollbar widget

查看:79
本文介绍了SWT独立滚动条小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在SWT中创建独立"滚动条?我想拥有一个可以完全控制自己的滚动条,并使用它来控制另一种控件的内容,例如,使用Table控件中的内置"滚动条是不可能的.

Is there a way to create a "standalone" scrollbar in SWT? I would like to have a scrollbar which I have full control over myself and use it to control the contents of another widget in a way which isn't possible with the "built-in" scrollbars in the Table widget, for example.

推荐答案

我同意您可能无法单独获得滚动条,但是我已经通过使用Canvas(或ScrolledComposite)解决了该问题,然后设置了内容该组合的大小与ScrolledComposite.getClientArea()的大小完全相同.这可能需要进行一些微调,并且您必须确保内容组件与ScrolledComposite一起调整大小,但是应该可以.

I agree that you probably can't get a scrollbar alone, but I've worked around that with using a Canvas ( or ScrolledComposite ) and then set the content of that composite to exactly the same size as the ScrolledComposite.getClientArea(). That may require a bit fine tuning and you have to make sure that the content component resizes together with the ScrolledComposite, but should be possible.

然后,您可以获取ScrolledComposite的滚动条,并独立于ScrolledComposite使用它们.

You can then get the Scrollbars of the ScrolledComposite and use them independently of the ScrolledComposite.

这篇关于SWT独立滚动条小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆