| [gef-dev] Canvas Scrolling problem |
final
static int SIZE = 1000;setSize(SIZE,SIZE);
final ScrollBar horizontalBar = getHorizontalBar();
horizontalBar.setMaximum(SIZE);
final ScrollBar verticalBar = getVerticalBar();
verticalBar.setMaximum(SIZE);
final Point origin = new Point(0,0);
final Canvas scrollCanvas = this;
addMouseMoveListener(this);
horizontalBar.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
int destX = -horizontalBar.getSelection();
scrollCanvas.scroll(
destX, origin.y, origin.x, origin.y, SIZE, SIZE, true );
origin.x = destX;
}
} );
verticalBar.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
int destY = -verticalBar.getSelection();
scrollCanvas.scroll(
origin.x, destY, origin.x, origin.y, SIZE, SIZE, true );
origin.y = destY;
}
} );
DISCLAIMER:
This message contains privileged and confidential information and is intended only for an individual named. If you are not the intended recipient, you should not disseminate, distribute, store, print, copy or deliver this message. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version.