1

My dialog have two TreeViewer components. The vertical scroll bars have to be synchronized. I have tried with setSelection and setTopItem methods but both have no effect to other tree.

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());
    }
});

Any ideas?

César
  • 9,939
  • 6
  • 53
  • 74
MKK
  • 2,431
  • 20
  • 16

1 Answers1

-2

The solution:

vBar1.addListener(SWT.Selection, new Listener() {
        @Override public void handleEvent(Event arg0) {
        double y = vBar1.getSelection()*xViewerRight.getTree().view.bounds().height/100;
        NSPoint nsPoint = new NSPoint();
        nsPoint.x = 0;
        nsPoint.y = y;
        xViewerRight.getTree().view.scrollPoint(nsPoint);
        }
    });
MKK
  • 2,431
  • 20
  • 16
  • 1
    @Imray it is MAC OS specific class, i asume one can use Point instead – MKK Jul 18 '13 at 05:41
  • THanks. I was under the impression that SWT works across all systems. Can you tell me as well What are `xViewerLeft` and `xViewerRight`? – CodyBugstein Jul 18 '13 at 14:00
  • @Imray xViewerLeft is component from nebula package http://www.eclipse.org/nebula/widgets/xviewer/xviewer.php – MKK Jul 19 '13 at 07:29