Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » horizontal scroll with mouse wheel
horizontal scroll with mouse wheel [message #238816] Wed, 03 October 2007 12:13 Go to next message
Eclipse User
Originally posted by: manojm.blr.interrasystems.com

Hi! All,

Could you please tell me the way to implement horizontal scroll with
mouse wheel event on GraphicalViewer? (like SHIFT button + mouse scroll)

I would be thankful, if you could me some code snippet.

Regards,
Manoj
Re: horizontal scroll with mouse wheel [message #720646 is a reply to message #238816] Wed, 31 August 2011 01:56 Go to previous message
Baek, Kyeong Myeong is currently offline Baek, Kyeong Myeong
Messages: 1
Registered: August 2011
Junior Member
try this code in your project
GraphicalViewer viewer = getGraphicalViewer();

KeyHandler keyHandler = new KeyHandler();


viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD2),
		new MouseWheelHandler() {
			final int DELTA = 20;

			@Override
			public void handleMouseWheel(Event event,
					EditPartViewer viewer) {
				ScalableFreeformRootEditPart rootEditPart_;
				rootEditPart_ = (ScalableFreeformRootEditPart) viewer
						.getRootEditPart();
				Viewport viewport = rootEditPart_.getZoomManager()
						.getViewport();
				if (viewport != null) {
					viewport.setViewLocation(viewport.getViewLocation()
							.translate(DELTA * event.count, 0));
					event.doit = false;
				}
			}
		});
Previous Topic:connection feedbacks
Next Topic:Adding a Ctrl-i keystroke
Goto Forum:
  


Current Time: Sat Sep 20 18:02:44 GMT 2014

Powered by FUDForum. Page generated in 0.01845 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software