Template Canvas set scrollbar position?

I have a number of templates in a template canvas, and depending on the active process I want to “jump” to the position of a specific template in the canvas when the window is opened. If you navigate away from a window that has the canvas, and back again the canvas scrollbar resets back to a 0 reference, trying to prevent the need for an operator to scroll through the canvas should they navigate to another screen.

I’d like something like this on a window opened script:

if template1 active:
    setScrollBarPosition = 100
elif template2 active:
    setScrollBarPosition = 200
elif template3 active:
    setScrollBarPosition = 300
else:
    setScrollBarPosition = 0

Possible?

Consider modifying your navigation to use openWindow() instead of swapTo() when leaving this specific window. That’ll leave it open in the background, holding all of its state.

There is more to the story that I laid out, and unfortunately your suggestion isn’t ideal as it still requires the operator to scroll through as needed. This is a long duration process so I’d like the system to self update if possible.

It is possible, you can access the underlying JScrollPane from Ignition as explained here: Scroll bar is slow

Once you have the JScrollPane, you can set the view rectangle on it (search for Java docs to set that). Then the scrollbars will adjust until that rectangle is visible.

Setting the scrollbar position directly isn’t possible AFAIK, but setting the view rectangle is more robust anyway.