SCROLLEDCOMPOSITE直接布局在SHELL上或COMPOSITE上时,滚动条可以正确响应鼠标滚轮事件,可当存在TABFOLDER控件时,无论是布局在SHELL还是TABFOLDER上的SCROLLEDCOMPOSITE的滚动条都无法响应鼠标滚轮事件.请问谁有相关经验能够解决TABFOLDER上SCROLLEDCOMPOSITE滚动条响应鼠标滚轮事件,谢谢.
protected void createContents() {
shell = new Shell();
shell.setSize(800, 600);
shell.setText("SWT Application");
shell.setLayout(null); final TabFolder a = new TabFolder(shell, SWT.NONE);
a.setBounds(220,0,200,600);
//a.setVisible(false);
final ScrolledComposite b = new ScrolledComposite(a, SWT.V_SCROLL);
b.setBounds(0,0,200,600);
final Composite d = new Composite(b, SWT.NONE);
d.setBounds(0,0,200,1200);
d.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
final ScrolledComposite c = new ScrolledComposite(shell, SWT.V_SCROLL);
c.setBounds(0,0,200,600);
//c.setVisible(false);
final Composite e = new Composite(c, SWT.NONE);
e.setBounds(0,0,20,1200);
c.setContent(e);
b.setContent(d);
c.getVerticalBar().addSelectionListener(new SelectionListener(){
public void widgetSelected(SelectionEvent e){
b.getVerticalBar().setSelection(c.getVerticalBar().getSelection());
}
public void widgetDefaultSelected(SelectionEvent e){
}
});
}
protected void createContents() {
shell = new Shell();
shell.setSize(800, 600);
shell.setText("SWT Application");
shell.setLayout(null); final TabFolder a = new TabFolder(shell, SWT.NONE);
a.setBounds(220,0,200,600);
//a.setVisible(false);
final ScrolledComposite b = new ScrolledComposite(a, SWT.V_SCROLL);
b.setBounds(0,0,200,600);
final Composite d = new Composite(b, SWT.NONE);
d.setBounds(0,0,200,1200);
d.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
final ScrolledComposite c = new ScrolledComposite(shell, SWT.V_SCROLL);
c.setBounds(0,0,200,600);
//c.setVisible(false);
final Composite e = new Composite(c, SWT.NONE);
e.setBounds(0,0,20,1200);
c.setContent(e);
b.setContent(d);
c.getVerticalBar().addSelectionListener(new SelectionListener(){
public void widgetSelected(SelectionEvent e){
b.getVerticalBar().setSelection(c.getVerticalBar().getSelection());
}
public void widgetDefaultSelected(SelectionEvent e){
}
});
}
楼主【getserved】截止到2008-07-15 10:06:16的历史汇总数据(不包括此帖):
发帖的总数量:2 发帖的总分数:20 每贴平均分数:10
回帖的总数量:2 得分贴总数量:1 回帖的得分率:50%
结贴的总数量:2 结贴的总分数:20
无满意结贴数:1 无满意结贴分:20
未结的帖子数:0 未结的总分数:0
结贴的百分比:100.00% 结分的百分比:100.00%
无满意结贴率:50.00 % 无满意结分率:100.00%
敬礼!
应该在TabFolder上加TabItem,然后再在这个TabItem加composite