how to replicate scrollview with panel

harlechguy

Member
Licensed User
Longtime User
Hi all. In order to capture left and right swipe movements on a scrollview i have overlayed the scrollview with an invisible panel.

This works fine but means that access to the scrollview via the touchscreen is lost.

To overcome this i have captured the up and down touch events on the invisible panel but appear to be restricted to using the scrollposition parameter on the scrollview. Whilst this does allow correct positioning it does not replicate the behaviour of a scrollpanel.

Is there another way of handling this situation?

Many thanks
(Ps i posted this q against another post but have moved it as it is really a new q)
 

harlechguy

Member
Licensed User
Longtime User
Hi Nj, thanks for reply, i have a scrollview which contains a single image the size of the inner panel. (The image is a page from a book)

I want to load into the panel a different image if the user swipes left or right - a bit like turning the pages of a book. I have used an invisible panel overlayed onto the top to capture the side swipes. This works well but prevents access to the scrollview.

To overcome this i have captured the up and doen swipes on the panel and used this to set the scrollview position. This works ok but does not fully replicate the behaviour of a scrollview eg 'flicking' the screen
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
An alternative may be to use the Gestures library to detect touch events on your ScrollView - no need to add the transparent panel.

You create a Sub which the Gestures library calls when a touch event occurs and that Sub must return a Boolean value to indicate whether the Sub has handled the touch event (return True) or not handled the touch event (return False).

So in that Sub detect whether a left/right swipe has occurred - if it has then change the image and return True, otherwise return False and (hopefully) the event will then propogate through to the ScrollView where normal ScrollView scolling will be performed.

Martin.
 
Upvote 0

harlechguy

Member
Licensed User
Longtime User
Guys, thanks for the responses.

am pretty new to this and the help is much appreciated

Looks like I have lots of options to try. Will be running through them all later (after work!).

thanks again for all the suggestions.
 
Upvote 0

harlechguy

Member
Licensed User
Longtime User
Hi all, tried out the 3 suggestions (very much appreciated) that were made.

the use of the gestures library worked best for me as it required the least additional coding and was closest to the end result I was looking for

as alway..........help much appreciated.

thanks
 
Last edited:
Upvote 0
Top