Script viewport position
-
I believe this was already asked somewhere but I couldn't find it.
Is there a way to script the vertical or horizontal scrolling of a viewport?
-
@d-healey Nope you can't... I tried to implement it myself but the viewport is a very strange beast in Hise, and I don't see the relation to Juce and where/how to modify the existing behaviour (or add methods)
-
I've added a
viewPositionX
andviewPositionY
property to the viewport, so you can set it using the usual methods.However it's unidirectional though, so scrolling the viewport with the scrollbar will not change this property (adding this is a bit more complicated, but let me know if you require this).
-
@Christoph-Hart Thank you, I'll play around with it this afternoon.
-
I needed this to be unidirectional for now so all good. Because when you add child panels to a list, sometimes (although not always) the viewport was following the incrementing list which is rarely the behavior you want. So setting it back to 0 pos when reconstructing the list is cool. I was using a trick for this before having a method.
-
@Christoph-Hart Yep this works perfectly!