Is there a way to scroll / move an item continuously on a button hold?

This is difficult to word properly - but I’m trying to move a ribbon of content horizontally - and continuously - within a dynamic panel as long as a button is held.

Really what I want is exactly the behavior of a browser scrollbar - where if you click and hold the bottom arrow the page moves down until you release (at which point it stops in place).

Obviously this can be done to specific fixed positions with anchors or moving to X locations - but is there anything I can use that would be more fluid and variable (start onpress and stop onrelease)?

Ugh, I wonder if I’m wording this clearly at all…onLongClick with onMouseUp works for the button interaction - I just can’t figure out how to move move the item the way I want…

This is pretty easy using a looping widget. Before you start, add an invisible widget, we’ll call it Scroller.

The OnLoad event of that widget will have two cases like:

OnLoad
IF value of variable ScrollDown equals “true”
Move YourContent by y:1, x:0

ELSE IF value of variable ScrollUp equals “true”
Move YourContent by y:-1, x:0

IF True
Wait 10ms
Fire event this widget OnLoad

Then on your down arrow, for example:

OnMouseDown
Set variable ScrollDown to “true”

OnMouseUp
Set variable ScrollDown to “false”

Repeat for your up arrow with the other variable.

This should do the trick. What is happening is the hidden widget is checking every 10ms whether one of the variables is true, and if so, moving the content by 1. This means that while the variable is true, it moves by 1px every 10 ms. Adjust as needed. You’ll notice that since it’s just checking the variables, it doesn’t really matter HOW the user initiates the scroll. You could have ANY interaction set the correct variables and it will scroll. There are lots of things to adjust here and optimizations that can be made, but this should get you started.

1 Like

Took me awhile to understand what you meant here - but it did work well once I did. Thanks!