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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 281
Registered: ‎05-31-2012
My Device: Playbook
My Carrier: o2

ReferenceError: Can't find variable: blackberry

Hi, I dont know what I'm doing wrong with webworks, but when i use remote debug on the dev alpha, I always get:

ReferenceError: Can't find variable: blackberry 

 here is my whole code:

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
    <link rel="stylesheet" href="BlackBerry-JQM-all.css" />
    <script src="BlackBerry-JQM-all.js"></script>
</head>
<body>
	[...]
    <script type="text/javascript" src="local:///chrome/webworks.js"></script>
    <script src="code.js"></script>
</body>
</html>

 and the code.js:

document.addEventListener("webworksready", start());

function start() {
    // context menu
    blackberry.ui.contextmenu.addItem([
		blackberry.ui.contextmenu.CONTEXT_ALL
    ], {
        actionId: 'delete',
        label: 'Delete',
        icon: 'local:///delete.png'
    }, function () {
        alert('Delete!');
    });
}

$(document).ready(function () {
    [...]
});

 

why i get the Can't find variable: blackberry ?

Plase "+Like" my post if it was helpful.
Contributor
Posts: 33
Registered: ‎04-30-2012
My Device: PlayBook, DevAlpha
My Carrier: 3AT

Re: ReferenceError: Can't find variable: blackberry

How does your config.xml look like? Did you add <feature id="blackberry.ui.contextmenu" /> to it?

Developer
Posts: 281
Registered: ‎05-31-2012
My Device: Playbook
My Carrier: o2

Re: ReferenceError: Can't find variable: blackberry

Yes i have
Plase "+Like" my post if it was helpful.
Developer
Posts: 322
Registered: ‎08-06-2012
My Device: Dev Alpha / Playbook / Curve 9300

Re: ReferenceError: Can't find variable: blackberry

The next logical question for me is: What BB10 SDK are you using?  Is it the latest 1.0.3.8?

 

That error happens when you call a Blackberry API, like you are calling the contextmenu, AND the api is not found.  So you have followed the documentation well, but I remember the webworks.js call was different before this.  In fact previously we had to copy it into our project then it changed... anyway, check the SDK version you have installed OR are trying to compile with.  You may even have multiple versions installed.

If it helped you, click like. Smiley Happy