# Capture mouse wheel movement

**URL:** <https://forum.inductiveautomation.com/t/capture-mouse-wheel-movement/19083>\
**Category:** Ignition\
**Created:** [August 2, 2018, 8:26pm UTC](https://forum.inductiveautomation.com/t/capture-mouse-wheel-movement/19083 "2018-08-02T20:26:14Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![jsorlie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jsorlie/32/3645_2.png) [@jsorlie](https://forum.inductiveautomation.com/u/jsorlie)\
**Post date:** [November 3, 2018, 12:36pm UTC](https://forum.inductiveautomation.com/t/capture-mouse-wheel-movement/19083/8 "2018-11-03T12:36:52Z")

</div>

Expanding on code by @sfitze to access custom properties added to the component; cf [AbstractVisionComponent](http://files.inductiveautomation.com/sdk/javadoc/ignition784rc1/com/inductiveautomation/vision/api/client/components/model/AbstractVisionComponent.html)

```auto
def MouseWheelListener(self, initialized):

	if not initialized:
		from java.awt.event import MouseWheelEvent
		from java.awt.event import MouseWheelListener
		
		class canvasMouseWheelListener(MouseWheelListener):
			def mouseWheelMoved(self, event):
				# https://docs.oracle.com/javase/tutorial/uiswing/events/mousewheellistener.html
				# https://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html
				if event.isAltDown() or event.isControlDown() or event.isShiftDown():
					canvas = event.source.parent.getComponent('Paintable Canvas')
					scale = canvas.getPropertyValue("scale") + 10*event.getWheelRotation()
					canvas.setPropertyValue("scale",scale)
				return

		for i in self.mouseWheelListeners:
			if i. __class__. __name__ == 'canvasMouseWheelListener':
				self.removeMouseWheelListener(i)
		self.addMouseWheelListener(canvasMouseWheelListener())
		self._mwlInit = True
	return

```

Kudos to @pturmel for all the guidance

---

_[View the full topic](https://forum.inductiveautomation.com/t/capture-mouse-wheel-movement/19083)._
