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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
Developer
TheFlowFX
Posts: 164
Registered: ‎02-15-2012
My Carrier: Bags are useful

Disable Context Menu

Is there anyway to disable the context menu that pops up when you press and hold an image in Blackberry 10? Im using bbUi.js and was wondering if that is possible.

If any post helps you please click the Like Button below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!

Please use plain text.
BlackBerry Development Advisor
chadtatro
Posts: 410
Registered: ‎10-01-2009
My Carrier: Bell

Re: Disable Context Menu

This thread should help get you in the right direction.  I believe that you're basically capturing the touch event, then preventDefault(); which stops the default behavior of said event from firing.

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Disable-context-menu-on-taphold/...

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Please use plain text.
Developer
TheFlowFX
Posts: 164
Registered: ‎02-15-2012
My Carrier: Bags are useful

Re: Disable Context Menu

Im using bbUi.js so I have to load scripts externally. Also, Im using a table with Images and Im not sure exactly how to implement that coding you provided.

<table width="100%">
  <tr>
    <td><img src="images/n1.png" height="266px" width="204px" onclick="blackberry.system.setWallpaper('local:///images/n1.png');"/></td>
    <td><img src="images/n2.png" height="266px" width="204px" onclick="blackberry.system.setWallpaper('local:///images/n2.png');"/></td>
    <td><img src="images/n3.png" height="266px" width="204px" onclick="blackberry.system.setWallpaper('local:///images/n3.png');"/></td>
</tr>
</table>

 Thanks for your help

 

 

If any post helps you please click the Like Button below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!

Please use plain text.
BlackBerry Development Advisor
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Carrier: Virgin

Re: Disable Context Menu

You have 2 options to prevent it:

window.oncontextmenu = function (evt) {
    evt.preventDefault();
}
OR You will need to include local:///chrome/webworks.js in your app as well as the feature blackberry.ui.contextmenu adn then you can do the following:
blackberry.ui.contextmenu.enabled = false;
@erikjohnzon
erjohnson@blackberry.com
Please use plain text.