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
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
Accepted Solution

Prevent user interaction with control

I have a MapView that I want to "lock".  I don't want the user to be able to zoom or scroll around the map at all, I've been testing ignoring touchEvents but that hasn't been working for me.

 

Any thoughts?

Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Prevent user interaction with control

Have you tried blocking all the signals using blockSignals?

 

http://developer.blackberry.com/native/reference/cascades/qobject.html#blockSignals


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: Prevent user interaction with control

mapView->blockSignals(true);

 still prints to the console and the map moves

Debug: 11:39:11:  "Event[Touch] Time[11:39:11:421] Phase[3] Type[1] Screen[289,151] Window[289,151] Local[289,151]" 
Debug: 11:39:11:  MapViewPrivate::setLocationWindowDelta(  QPoint(0,1)  ) 
Debug: 11:39:11:  "Event[Touch] Time[11:39:11:446] Phase[3] Type[1] Screen[289,150] Window[289,150] Local[289,150]" 
Debug: 11:39:11:  MapViewPrivate::setLocationWindowDelta(  QPoint(0,1)  ) 
Debug: 11:39:11:  "Event[Touch] Time[11:39:11:473] Phase[3] Type[1] Screen[288,150] Window[288,150] Local[288,150]" 
Debug: 11:39:11:  MapViewPrivate::setLocationWindowDelta(  QPoint(1,0)  ) 
Debug: 11:39:11:  "Event[Touch] Time[11:39:11:487] Phase[3] Type[1] Screen[288,149] Window[288,149] Local[288,149]" 
Debug: 11:39:11:  MapViewPrivate::setLocationWindowDelta(  QPoint(0,1)  ) 
Debug: 11:39:11:  "Event[Touch] Time[11:39:11:505] Phase[3] Type[2] Screen[283,148] Window[283,148] Local[283,148]" 

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Prevent user interaction with control

In such a case I would typically think of throwing in an "overlay" object, layered so it appears above the item in question (a simple way is to use a DockLayout and make sure the second item is defined after the first item, resulting in a higher position in the Z order). The overlay object would intercept all user activity and basically discard it.

Depending on the layout involved, however, it is likely simpler to use the VisualNode property touchPropagationMode: https://developer.blackberry.com/native/reference/cascades/bb__cascades__visualnode.html#property-to... on either the item in question, or its parent.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Prevent user interaction with control

Actually I meant on the parent it only blocks signals going out.
Similar to Peters idea you could also put a container underneath (but not it's ancestor) and toggle the Overlap policy on and off.

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Prevent user interaction with control

Take a look at this as there are many ways to do it using another object in some way connected or overlapped...

http://developer.blackberry.com/native/documentation/cascades/dev/touch/touch_propagation.html

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: Prevent user interaction with control

I have the parent Container setup with touchCapture, I will try overlapping objects again, I put a container over the map a while back and the touch still propagated to the map. I'll try again with different objects..thanks
Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Prevent user interaction with control

If you take a look at the link I provided you'll be able to see why it possibly didn't work the first time you tried it, as depending where the objects are in the scene graph determines how the signals propagate.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: Prevent user interaction with control

I wasn't setting setTouchPropagationMode(TouchPropagationMode::None). Seems to be blocking map movement now

Thanks
Please use plain text.