# Synchronize the scroll bars between 2 template canvases

**URL:** <https://forum.inductiveautomation.com/t/synchronize-the-scroll-bars-between-2-template-canvases/43491>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [February 16, 2021, 11:57pm UTC](https://forum.inductiveautomation.com/t/synchronize-the-scroll-bars-between-2-template-canvases/43491 "2021-02-16T23:57:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![aharris](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@aharris](https://forum.inductiveautomation.com/u/aharris)\
**Post date:** [February 17, 2021, 5:27pm UTC](https://forum.inductiveautomation.com/t/synchronize-the-scroll-bars-between-2-template-canvases/43491/3 "2021-02-17T17:27:37Z")

</div>

I figured it out thanks to another post:  
[[Scroll bar is slow](http://forum.inductiveautomation.com/t/scroll-bar-is-slow/5043/6)]

I needed to add “.getComponents()[2].getComponents()[0]” to the end of how I was referencing the components.

I placed this script in the window’s internalFrameOpened event handler and now my my template canvas scroll position tracks with another one.

```auto
from javax.swing import SwingUtilities
from javax.swing import JScrollPane

mainPane = SwingUtilities.getAncestorOfClass(JScrollPane, system.gui.getParentWindow(event).getComponentForPath('Root Container.Group 1.Template Canvas 1').getComponents()[2].getComponents()[0])
 
#def myScrollEvent(event = event, mainTable = tbl):
def myScrollEvent(event = event, mainPane = mainPane):	
	mainPanePosition = mainPane.getHorizontalScrollBar().getValue()
	headerPane = SwingUtilities.getAncestorOfClass(JScrollPane, system.gui.getParentWindow(event).getComponentForPath('Root Container.Group 1.Template Canvas 2').getComponents()[2].getComponents()[0])
	headerPane.getHorizontalScrollBar().setValue(mainPanePosition)
mainPane.viewport.addChangeListener(myScrollEvent)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/synchronize-the-scroll-bars-between-2-template-canvases/43491)._
