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
New Developer
Posts: 16
Registered: ‎05-14-2013
My Device: Z10 STL 100-2, Playbook wifi only
Accepted Solution

Help me solve my problem with onTouch in imageView acting before i have a chance to scroll Please

Hi, please help.
I have an a few imageviews within a scrollview. Ontouch will navigate me to another page, however, the moment I touch the image, it takes me to the appropriate page with no chance to scroll down. How do I get it to scroll and then touch the image to navigate. It seems that ontouch is competing with scrollview and ontouch wins.

 

how do I set it up to scroll through my vertically arranged imigeviews and then when i find the item I want, I touch it and it goes to the next page which is a seperate qml file.

 

the scroll workes fine when i comment out the ontouch section and the ontouch work fine as well.

 

i have it as:

 

ImageView {
            horizontalAlignment: HorizontalAlignment.Center
            imageSource: "asset:///images/Sunshine.jpeg"
            preferredWidth: 700.0
                preferredHeight:200.0
            minWidth: 30.0
            minHeight: 30.0
                onTouch: {
                var page = getThirdPage();
                console.debug("pushing detail " + page)
                navigationPane.push(page);
                }
            property Page thirdPage
            function getThirdPage() {
                if (! thirdPage) {
                    thirdPage = thirdPageDefinition.createObject();
               }
                return thirdPage;
            }
            attachedObjects: [
                ComponentDefinition {
                    id: thirdPageDefinition
                    source: "thirdfilepage.qml"
               }
           ]
}
  

I have several of these image views, all wraped in a single scrollview.    



I have tried to find this through Google as well as the cascades documentation with no luck. I would appreciate any help, please

Thanks
Roland

Thank you
Regards
Roland
Developer
Posts: 653
Registered: ‎10-08-2009
My Device: Bold 9900

Re: Help me solve my problem with onTouch in imageView acting before i have a chance to scroll Please

Don't use onTouch to handle tap events, onTouch will fire a signal as soon as touch event is received. Use gestureHandler instead - this will give you more options for complete gesture (tap, double tap, long press).

 

gestureHandlers: [
        TapHandler {
            onTapped: {
                // PUSH PAGE OR SOMETHING HERE
            }
        }
    ]

Hope it helps!

 

 

----------------------------------------------------------
Twitter: @gyubok
New Developer
Posts: 16
Registered: ‎05-14-2013
My Device: Z10 STL 100-2, Playbook wifi only

Re: Help me solve my problem with onTouch in imageView acting before i have a chance to scroll Please

Thank you very much, I shall try it out when I get a chance and will report back.

 

Kind Regards

Roland

Thank you
Regards
Roland
New Developer
Posts: 16
Registered: ‎05-14-2013
My Device: Z10 STL 100-2, Playbook wifi only

Re: Help me solve my problem with onTouch in imageView acting before i have a chance to scroll Please

Thanks. It worked well

Regards
Roland
Thank you
Regards
Roland
Developer
Posts: 653
Registered: ‎10-08-2009
My Device: Bold 9900

Re: Help me solve my problem with onTouch in imageView acting before i have a chance to scroll Please

I'm glad it worked without any problems!

 

Please mark this thread resolved!

----------------------------------------------------------
Twitter: @gyubok