Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
szj087
Posts: 17
Registered: ‎07-17-2012
My Device: N/A
My Carrier: N/A

How can use swipe/flick gesture in cascade application

Hi, 

 

I want to use flick guesture in Cascade application, but I found there is only long press, tap and pinch event in Cascade.  How can I complete flick action with Cascade? Should I use touch down, move to emulate  flick action?

 

thanks/BRs

Zongjun

Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: How can use swipe/flick gesture in cascade application

Hi there,

You could implement your own listening to Touch events:
https://developer.blackberry.com/cascades/reference/bb__cascades__touchevent.html

If you would like to post a feature request for a complete flick gesture event, I suggest you post a feature request here:
https://www.blackberry.com/jira/secure/Dashboard.jspa

Martin

Please use plain text.
Contributor
szj087
Posts: 17
Registered: ‎07-17-2012
My Device: N/A
My Carrier: N/A

Re: How can use swipe/flick gesture in cascade application

Thanks

 

I will do that

 

BRs

Zongjun

Please use plain text.
Contributor
cellinova
Posts: 11
Registered: ‎10-05-2012
My Device: Blackberry 10 Dev Alpha Device
My Carrier: Rogers

Re: How can use swipe/flick gesture in cascade application

I thought I would share my code I used to simulate a swipe.  I wish the Touch event included a velocity attribute so that I know that the user is actually doing a swipe.

 

                onTouch: {

                    if (event.isDown()) {

                        downX = event.windowX;

                        downY = event.windowY;

                    } else if (event.isUp()) {

                        var yDiff = downY - event.windowY;

                        // take absolute value of yDiff

                        if (yDiff < 0) yDiff = -1 * yDiff;

                        // I check if the minimum y movement is less than 200.  Don't want to move left or right if 

                        // the user is actually want to move up or down.

                        if ((yDiff) < 200) {

                            if ((downX - event.windowX) > 320) {

                                // move right

                            } else if ((event.windowX - downX) > 320) {

                                 // move left

                            }

                        }

                    }

                }

 
Please use plain text.
Contributor
cellinova
Posts: 11
Registered: ‎10-05-2012
My Device: Blackberry 10 Dev Alpha Device
My Carrier: Rogers

Re: How can use swipe/flick gesture in cascade application

Forgot to mention that I defined two properties downX and downY

 

    property int downX: 0

    property int downY: 0

    onTouch: {

                    if (event.isDown()) {

                        downX = event.windowX;

                        downY = event.windowY;

                    } else if (event.isUp()) {

                        var yDiff = downY - event.windowY;

                        // take absolute value of yDiff

                        if (yDiff < 0) yDiff = -1 * yDiff;

                        // I check if the minimum y movement is less than 200.  Don't want to move left or right if 

                        // the user is actually want to move up or down.

                        if ((yDiff) < 200) {

                            if ((downX - event.windowX) > 320) {

                                // move right

                            } else if ((event.windowX - downX) > 320) {

                                 // move left

                            }

                        }

                    }

                }

 
Please use plain text.
New Developer
sumithpdd
Posts: 11
Registered: ‎03-14-2013
My Device: z10 , q10
My Carrier: vodaphone

Re: How can use swipe/flick gesture in cascade application

[ Edited ]

Will the touchpoint be different for Q10, i tried this code on Q10 and its a bit jerky (Q10 - swipe right to left is sticky). Dont we have anything in the framework for this.

Please use plain text.
Developer
saprykin
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: How can use swipe/flick gesture in cascade application

There is no swipe gesture in Cascades - only in NDK. So you need to use touch events as mentioned above.
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Please use plain text.
New Member
dartrack
Posts: 3
Registered: ‎06-12-2013
My Device: 8520
My Carrier: t&t

Re: How can use swipe/flick gesture in cascade application

you can check this link 

Please use plain text.