I have two ScrolledComposite
s and I'm synchronizing their vertical scroll positions like this:
final ScrollBar vScroll1 = canvasScroll.getVerticalBar();
final ScrollBar vScroll2 = titleScroll.getVerticalBar();
vScroll1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
titleScroll.setOrigin(titleScroll.getOrigin().x, canvasScroll.getOrigin().y);
}
});
vScroll2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
canvasScroll.setOrigin(canvasScroll.getOrigin().x, titleScroll.getOrigin().y);
}
});
This works fine, except it shows the scrollbars for both ScrolledComposites
. I only want one ScrolledComposite
's scrollbars to be visible, so I set one of their visibilities to false:
vScroll2.setVisible(false);
This has no effect. I also tried to instantiate the ScrolledComposite
without the SWT.V_SCROLL
flag, but this results in a null pointer exception when running the above code. The scrollbar does need to be there, I just want it to be invisible. Is that possible?