我的對話框有兩個TreeViewer
組件。垂直滾動條必須同步。 我試過setSelection
和setTopItem
方法,但兩者對其他樹都沒有影響。滾動TreeViewer樹SWT
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());
}
});
任何想法?
什麼是'xViewerLeft'和'xViewerRight'? – CodyBugstein