Vertical scrolling in viewport using mouse wheel on template repeater

The scroll speed was really slow on my template repeater. After a bit of searching through the Ignition Forums, I found some helpful posts and comments that led me to implement the code shown below when the template repeater is loaded.

My issue is that I can only use the mouse-wheel to scroll vertically when the mouse-pointer where the scroll-bar is located. I would like to be able to scroll when the mouse is inside anywhere in the template repeater (the green box in my image). How do I make that happen?

if (event.source == "componentRunning"):
    from javax.swing import SwingUtilities
    from javax.swing import JScrollPane
    
    scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane, event.source.getComponents()[1].getComponents()[2])
    scrollPane.getVerticalScrollBar().setUnitIncrement(50)

I’m not sure why it isn’t scrolling when the pointer is outside of the scroll bar, but I don’t think your propertyChange script is right. You’re checking if event.source == ‘componentRunning’ - should be event.propertyName == ‘componentRunning’.

1 Like

Oh, woops. I made that change, but still I am not able to scroll when the pointer is outside of the scroll bar.

I put this in the window’s internalFrameOpened event handler and it worked

repeater = system.gui.getParentWindow(event).getComponentForPath('Root Container.Template Repeater')
repeater.getComponents()[1].getVerticalScrollBar().setUnitIncrement(50)
2 Likes

Hi @ethomason - I think I marked this as a solution prematurely. I can tell that this code is working somewhat because my scrolling increments change successfully. But for any scrolling to occur at all, I have to place my mouse pointer exacly on the scrollbar. I’d like to be able to scroll when my mouse is anywhere on the template repeater.

Do you have code running anywhere else? Ignition version? The code works fine for me with my mouse over anywhere on the template repeater.

Do you have tooltips (mouseover text) on any of the components/the template itself in the repeater?

I don’t have tooltip, but I do have a script that runs on mouseEntered for some text inside each template instance. In the photo above, I have mouseEntered text on Hand Add and Saute.

There’s some code on each template. Each small white box inside every template is a clickable checkbox. There’s scripting associated with each one.