2 并排滚动复合。
我正在为我的 eclipse rcp 应用程序构建一个欢迎编辑器。我想要两个 ScrolledComposites 并排放置,每个上面都有一个标签。
Label 1 Label 2 Scrollable 1 Scrollable 2
现在我陷入了如何拳击的困境。
这似乎是正确的,但现在我无法获得正确的布局和侦听器。
- 复合A
- 复合A1
- 标签 1
- 可滚动 S1
- 复合A2
- 标签 2
- 可滚动 S2
- 复合A1
A1 应该设置 Scrollable S1 的最小尺寸,对吗?但谁来设置 S1 的大小以填充多余的空间呢?我发现的例子并不能正常工作。
顺便说一句,将所有内容放入 GridLayout 中也不起作用,因为我无法获取单元格大小。
I'm building a welcome editor for my eclipse rcp application. I want to have two ScrolledComposites sit side by side with a label above each.
Label 1 Label 2 Scrollable 1 Scrollable 2
Now I'm stuck in how to box.
This seems right but now I can't get the layouts and listeners right.
- Composite A
- Composite A1
- Label 1
- Scrollable S1
- Composite A2
- Label 2
- Scrollable S2
- Composite A1
A1 should set the min Size of Scrollable S1 right? But who sets the size of S1 so that it fills the excess space? The examples I found didn't work right.
BTW putting everything in a GridLayout didn't work either since I couldn't get the cell size.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么需要像元大小?只需为
S1
和S2
设置GridLayoutdata
即可填充单元格。最简单的使用GridLayoutFactory
:更新:请参阅 http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/ScrolledComposite.html
假设
s1
的内容是一个Composite c1
。然后使用 s1.setMinSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT)) 。A1
的大小无关紧要。Why would you need the cell size? Just set
GridLayoutdata
forS1
andS2
to fill the cell. It's simplest to useGridLayoutFactory
:UPDATE: See examples at http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/ScrolledComposite.html
Let's say content of
s1
is aComposite c1
. Then you uses1.setMinSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT))
. Size ofA1
is irrelevant.查看 SWT 代码段 中的“固定第一列水平滚动剩余列” - 尽管此示例适用于
Tables
,但它可以轻松转换为ScrolledComposites
。Have a look at the SWT Snippet for "fixed first column horizontal scroll remaining columns" - although this example is for
Tables
, it can easily be translated toScrolledComposites
.