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

Web and WebWorks Development

Reply
Developer
hari1
Posts: 64
Registered: ‎12-29-2012
My Device: None right now
Accepted Solution

Using Webworks Context Menus

I am using BB10 Jquery theme. I am a beginner. I am trying to add the context menu feature in my app. But I am not able to understand how to use the code given on this page https://developer.blackberry.com/html5/apis/blackberry.ui.contextmenu.html

I know BBUI is also available but I don't know how to use it and I have made my app's whole code and design using Jquery as it is very easy to use.

Could you please provide me complete working sample files or code to show how to add a context menu in a Jquery Webworks app?

BlackBerry Development Advisor
oros
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Using Webworks Context Menus

Hi there, this sample doesn't use the jQuery Mobile BB10 theme, but it does have a full implementation of the Context Menu APIs:
https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/CustomContext

Is that along the lines of what you were looking for?

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
hari1
Posts: 64
Registered: ‎12-29-2012
My Device: None right now

Re: Using Webworks Context Menus

Thanks for your reply but this sample is still dependent on BBUI.
Won't using that with jQuery cause problems?
BlackBerry Development Advisor
oros
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Using Webworks Context Menus

[ Edited ]

Correct, you don't want to be mixing bbUI and jQuery since they are both UI frameworks. EDIT: However the context menu implementation in the sample is not dependant on bbUI. bbUI does have its own Context Menu approach, but that is not what is implemented that sample.

While the Github sample uses bbUI for the general layout of the pages, the Context Menu implementation is a direct WebWorks API implementation which can be found here:
https://github.com/blackberry/BB10-WebWorks-Samples/blob/master/CustomContext/js/app.js

Specifically, based on these APIs:
http://developer.blackberry.com/html5/apis/blackberry.ui.contextmenu.html


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
hari1
Posts: 64
Registered: ‎12-29-2012
My Device: None right now

Re: Using Webworks Context Menus

[ Edited ]

I downloaded the sample, moved it into RippleSites folder and ran it in Ripple UI. Clicking and Holding the text does not activate the context menu. Chrome's console shows the following errors

GET local:///chrome/webworks.js
This webworks.js file does not load.

Uncaught TypeError: Cannot call method 'addItem' of undefined

I am using the latest versions of Chrome and Ripple UI.

Developer
hari1
Posts: 64
Registered: ‎12-29-2012
My Device: None right now

Re: Using Webworks Context Menus

I am still not able to figure out why this sample is not working. Please guide me :Helpsmilie:

BlackBerry Development Advisor
oros
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Using Webworks Context Menus

Ripple injects its own version of WebWorks.

local:///chrome/webworks.js is a file that gets packaged when you actually create a WebWorks application. That is the location of the file on the device / within your application space that lets you leverage WebWorks APIs.

Ripple is also not able to emulate the Context Menu, you will need to package the application and test on a BlackBerry 10 simulator or real device since the Context Menu has deeper integration into the OS than most WebWorks APIs.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.