Vertical Carousel Swipe

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
zigzigzig
Posts: 10
Joined: Tue May 30, 2017 11:31 pm

Vertical Carousel Swipe

Post by zigzigzig »

Hello all,

I've got a carousel control, and in order to get swiping working on it I've rotated it 90 degrees and then rotated necessary components on the design item (a label) -90 degrees. While it appears to be working, I've discovered that though rotated, the carousel is still only responding to left and right swiping on the x-axis, and not at all vertically (minuscule variations like diagonal swipes get a response but are too chaotic to be reliable). Is there a way I can properly enable vertical swiping only on a carousel, using rotation or otherwise?

thanks
- z
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Vertical Carousel Swipe

Post by Stewart Marshall »

From what you've said, you've effectively made a vertically scrolling set of panels by rotating everything in the Carousel so that it looks right.

Tree (Prim_tree) however provides exactly the functionality you need.

Use of both controls is just about identical. You can change your design part to implement #Prim_Tree.iTreeDesign instead of #Prim_caro.iCarouselDesign. The method names are the same for both.

Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
zigzigzig
Posts: 10
Joined: Tue May 30, 2017 11:31 pm

Re: Vertical Carousel Swipe

Post by zigzigzig »

thanks for the help, Stewart!

Can you do incremental scrolling on trees? I should have specified that this is the behavior I need, vertical swiping that
displays a singular entry and selects it automatically, without having to click on an entry.

thanks again,
- z
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Vertical Carousel Swipe

Post by Stewart Marshall »

Your request has highlighted that we could do with an Orientation property on Carousel, so please log an enhancement request for this.

And sadly, Tree will give you smooth scrolling as per any normal scrolling control and there's no real way around that.

However, there is a third option that doesn't use a visual list control. The technique is to use 2 panels that occupy the same space. When the upper panel is swiped (TouchMove is set to Vertical), it reveals the underlying panel which shows either the next or previous item depending on the direction of the swipe. This produces an effect similar to the image below when the user is mid swipe.
IMG_0887.PNG
IMG_0887.PNG (73.98 KiB) Viewed 8873 times
When the swipe action ends, if the image is 50% off the screen, an animation is used to complete the action, completely revealing the underlying image, or it is animated back to it start position.

As the the top image is now off the screen it can be updated to show the next/previous image and put back on top of the background image. As the two are identical, the user doesn't see any change.

This sounds quite complex, but the code is really quite straightforward.

Sample import attached

Regards
Attachments
Swiping.zip
(13.5 KiB) Downloaded 1136 times
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
Post Reply