我的对话框有两个TreeViewer
组件。垂直滚动条必须同步。我尝试过使用setSelection
andsetTopItem
方法,但都对其他树没有影响。
xViewerLeft = createXViewer(leftComposite, this);
xViewerRight = createXViewer(rightComposite, this);
xViewerLeft.getTree().getVerticalBar().addListener(SWT.Selection, new Listener() {
@Override public void handleEvent(Event arg0) {
//xViewerRight.getTree().setSelection(xViewerLeft.getTree().getSelection());
//xViewerRight.getTree().setTopItem(xViewerLeft.getTree().getTopItem());
}
});
有任何想法吗?