# Template Repeater Scroll With Power Table Objects

**URL:** <https://forum.inductiveautomation.com/t/template-repeater-scroll-with-power-table-objects/66583>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [November 16, 2022, 2:52pm UTC](https://forum.inductiveautomation.com/t/template-repeater-scroll-with-power-table-objects/66583 "2022-11-16T14:52:04Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 17, 2022, 7:09am UTC](https://forum.inductiveautomation.com/t/template-repeater-scroll-with-power-table-objects/66583/5 "2022-11-17T07:09:18Z")

</div>

> [@JustinHiemstra](#):
>
> **Question** : Is there a way to disable scroll on an individual power table, or somehow prevent focus of the power table object while the main window is being scrolled through?

I played around with this, and using the Power Table's initialize extension function and mouseExited event handler, I was able to add a listener like @paul-griffith suggested while simultaneously controlling the scroll bar policy of the individual tables that were not in focus.

**Here is the result:**

**Here is the code for the mouseExited event handler:**

```auto
from javax.swing import SwingUtilities, JScrollPane 
tableScrollbar = event.source.getComponent(2)
tableScrollPane = SwingUtilities.getAncestorOfClass(JScrollPane, tableScrollbar)
tableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER)

```

**Here is the code for the initialize extension function:**

```auto
	from java.awt.event import MouseWheelEvent, MouseWheelListener
	from javax.swing import SwingUtilities, JScrollPane 
	from java.awt import Point
	source = self
	tableScrollbar = source.getComponent(2)
	tableScrollPane = SwingUtilities.getAncestorOfClass(JScrollPane, tableScrollbar)
	tableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER)
	repeater = source.parent.parent.parent.parent.parent
	repeaterScrollBar = repeater.getComponents()[1].getComponents()[2]
	repeaterScrollPane = SwingUtilities.getAncestorOfClass(JScrollPane, repeaterScrollBar)
	repeaterScrollPane.getVerticalScrollBar().setUnitIncrement(10)
	repeaterScrollPane.getVerticalScrollBar().setBlockIncrement(10)
	class DebugMouseWheelListener(MouseWheelListener):
		def mouseWheelMoved(self, event):
			scrollAmount = event.getUnitsToScroll()
			currentRepeaterPosition = repeaterScrollPane.getViewport().getViewPosition().y
			currentTablePosition = tableScrollPane.getViewport().getViewPosition().y
			if (currentRepeaterPosition + (scrollAmount)) > 0 and not source.table.isFocusOwner():
				tableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER)
				repeaterScrollPane.getViewport().setViewPosition(Point(0,(currentRepeaterPosition + (scrollAmount*10))))
			else:
				tableScrollPane.setVerticalScrollBarPolicy(JScrollPane. VERTICAL_SCROLLBAR_AS_NEEDED)
	self.addMouseWheelListener(DebugMouseWheelListener())

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/template-repeater-scroll-with-power-table-objects/66583)._
