10-14-2012 12:03 AM
Hi
Can anyone tell me how the context menu works in bb10 or point me to some documentation. I can't quite figure it out by just looking at the API reference.
Wilson
10-14-2012 05:14 AM
Context menus are enabled by default on a WebWorks applications.
Simply long press on a image or text and you should see the context menu.
Menu has many platform defined actions for each type but it also provides the developer to ability to add new items for each type. So if you look at the API examples it allows you add an item for Image type
function addMyItem() {
var myItem = {actionId: 'MyItem', label: 'My Item', icon:'http://mysite.com/icon.png'},
contexts = [blackberry.ui.contextmenu.CONTEXT_IMAGE, blackberry.ui.contextmenu.CONTEXT_INPUT];
blackberry.ui.contextmenu.addItem(contexts, myItem);
}
Soon you will be define custom context as well
https://github.com/blackberry/BB10-WebWorks-Framew
10-14-2012 12:50 PM
10-14-2012 06:19 PM
10-14-2012 08:40 PM
I don't think bbUI is listening for the context menu yet it currently just creates its own. There is an issue open to change that (https://github.com/blackberry/bbUI.js/issues/233).
If you long hold an image within bbUI it brings up the system context menu, if you setup your own context menu within bbUI it will show that when it is supposed to as well.
I supposed there could be a conflict if you add your own context menu to an image - that is the one piece I haven't tried it yet.
10-15-2012 08:48 AM
We actually just released a sample app for Context Menu's last week on our GitHub repo which you could use for reference.
https://github.com/blackberry/BB10-WebWorks-Sample
12-18-2012 05:51 PM
Is it possbile to disable the context menu in webworks?
Because people should now be able to just tap and hold on images within my app and save them.
01-27-2013 12:52 PM
It's disabled by default. You need to ask for it in config.xml
01-27-2013 04:58 PM
Can you please describe what you mean with "You need to ask for it in config.xml"?
01-28-2013 05:09 AM
You need to add the feature to your config.xml, like this
<feature id="blackberry.ui.contextmenu" />