How to accomplish this???? (scrollview issue)

Cableguy

Expert
Licensed User
Longtime User
Hi again...

So I got my horizontal scroll view working... and I notice that only the ScrollChanged event is available...

I would like to have the views of the inner panel to always center after scroll...

I have 7 buttons on my scroll view's panel, of wich 4 are visible.
I would like to, when the user scrolls through the buttons, to have some kind of snap to position action at the end of the movement so that the 4 buttons in view get centered ....
This I believe would need the touch_up event to be fired(?), wich is not available...
Please :sign0085:
 
Last edited:

mc73

Well-Known Member
Licensed User
Longtime User
The easy way is to create a panel upon of the horizontalScrollView and place your centered buttons there.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I dont think you understood what i want to achieve...

Imagine an old 35mm photography film scrolling in front of a window...
Thats my scroll view... at any time I have a viewable window for 4 frames, my buttons...
What I want is to NOT have the scroll movement stopping in midle-frame, rendering 5 frames or buttons, in view, but only 3 fully shown...
So I need a "snap-to-position" routine so that only 4 buttons remain in view...

If needed I can provide my work in progress, as it is yet in very early stage..
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
That sounds like an interesting UI application.

I see that the HorizontalScrollView has a ScrollChanged event. You will probably want to monitor this.

I don't know if it only updates when the scroll position changes and stops or whether it updates as the scroll position is changing.

You may have to implement a timer which checks ScrollPosition to monitor the position changing and how fast it's changing – if that updates during a scroll.

You will then have to continue scrolling or somehow force a stop as the scrolling slows down and only stop at frame boundary positions.

Another way I could imagine would be to use a very wide panel to hold the frames, change the Left property of the panel to simulate scrolling, and then use the gesture library to monitor swipes. In a sense create your own horizontal scroll view, but this may give you more control over the scrolling, speed, and stop position.

This UI sounds interesting. It also sounds tricky to implement.

Barry.
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
The ScrollChanged event fires at evry deplacement of the inner panel, and only stops when the panel stops moving...
That is why I think...wich doesn't happen very often... that I would need to get touch_up event for the inner panel...
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
I see now.
You can start a timer from inside the scrollview_changed event.
When change stops, alter view's position to the one of the two possible combinations.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Hi Paulo,
Are you looking for something like this ?
You can play with the values in the two commented lines in the hscMenu_Touch routine.

Best regards.
 

Attachments

  • HorizontalSnapScroll.zip
    6.6 KB · Views: 445
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Hi Klaus...

As usual...on the dot...
All I have to do now is adjust it to my needs... wich shouldn't be too hard.
Many many thanks... for your time and expertise.
 
Upvote 0
Top