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
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Touchtype move doesn't seem to work

Hi,

 

I am using touch event to detect in scrollview. When touchtype is move I need to set some components to visible false. 

But its not working.Here is the code

 

if ( event.touchType == TouchType.Move) {

                               // {

                              

                                ad.visible=false

                                btn.visible=false

                            }

Rujuta Trivedi
Please use plain text.
Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10
My Carrier: Rogers

Re: Touchtype move doesn't seem to work

[ Edited ]

Hey there..

 

1) Is it going into the if statement at all? It should be if it's in the onTouch: { } area and the event is actually a move TouchType... 

2) Are you sure you have set the 'id:' of the relevant controls to ad and btn?

 

This works for me:

 

        Label {
            id: myLabel
            text: "label"
            verticalAlignment: VerticalAlignment.Center
            
            onTouch: {
                if (event.touchType == TouchType.Move) {
                	myButton.visible = true
                }
            }
        }
        Button {
            id: myButton
            visible: false
            onClicked: {
                myButton.visible = false
            }
        }

 

This also works (replacing the Label above)

        ScrollView {
	    onTouch: {
	        if (event.touchType == TouchType.Move) {
		       	myButton.visible = true
		}
            }
	    WebView {
	    }
        }

 

Please use plain text.