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
Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

adding a menu item and launching the context menu and custom pop-up menu

[ Edited ]

Hi,

 

Please help me quickly with my below requirement of managing context menu -

 

Context Menu:

1/  I require the context or shortcut menu (the menu that you get by clicking the blackberry menu item).

2/  Require to add and remove menu items at runtime based on some events.

3/  Menu items should be different in each page being navigated through.

4/  Also let me know how to know which context menu has been clicked and how can i pass the value to a next page.

 

Please note that I am using Visual Studio with BlackBerry web plugin vers 2.5 and Javascript.

I found examples on java but not through javascript in Visual studio environment.

 

Regards,

Giridhar

Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

Re: adding a menu item and launching the context menu and custom pop-up menu

Have done the following steps:

1)  wrote the below script in <html> - <head> tags

<

script type="text/javascript">  

var item = blackberry.ui.menu.addMenuItem(item);

 

 

item = new blackberry.ui.menu.MenuItem(false, 1, "Hello World", clickMe);

function clickMe() {

alert("user just clicked me");

}

 

</

script>

2)  Getting the below error :

Running  at line    1: var item=new blackberry.ui.menu.MenuItem(false,1,"Hello World",clickMe);.
: TypeError: Cannot convert 'undefined' to an object.

Can anyone let me know why am i getting this error. My config.xml has access and feature as -

  <access uri="http://www.blackberry.com" subdomains="true">
    <feature id="blackberry.ui.menu" required="true" version="1.0.0.0" />
  </access>

Regards,

Giridhar

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: adding a menu item and launching the context menu and custom pop-up menu

This issue is likely that you have the <feature> nested under the <access> element for www.blackberry.com.

 

When you put the <feature> element at the root of the document it will allow the functionality for any local pages you have packaged in your application.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

Re: adding a menu item and launching the context menu and custom pop-up menu

Done as suggested... yet getting the same error. How did anybody implemented this context menu handling from a vs.net environment.

Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9000
My Carrier: what is this.

Re: adding a menu item and launching the context menu and custom pop-up menu

My Config.xml reads as below -

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:rim="
http://www.blackberry.com/ns/widgets" version="1.0.0" rim:header="RIM-Widget:rim/widget" xmlns="http://www.w3.org/ns/widgets">
  <name>FlightEventsManager</name>
  <description />
  <author href="" rim:copyright="" email="">Giridhar</author>
  <content src="LoginPage.html" />
  <feature id="blackberry.ui.menu" required="true" version="1.0.0.0" />
  <feature id="blackberry.ui.dialog" required="true" version="1.0.0.0" />
  <access uri="
http://www.blackberry.com" subdomains="true"></access>
  <license href="" />
  <rim:cache disableAllCache="false" aggressiveCacheAge="2592000" maxCacheSizeTotal="1024" maxCacheSizeItem="128" />
</widget>

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: adding a menu item and launching the context menu and custom pop-up menu

[ Edited ]

Ahh.... It looks like you've run into the infamous "can't use dialog and menu in the same app" bug.  This is something that will be fixed and released in a couple of weeks from now

 

More details here:

http://supportforums.blackberry.com/t5/Web-Development/BUG-V6-0-blackberry-ui-dialog-and-blackberry-...

 

If you remove <feature id="blackberry.ui.dialog"/> from your config.xml element then the menu's will work.  It is a really odd issue around mixing built in APIs on the device and ones built into the webworks application.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 67
Registered: ‎09-23-2010
My Device: Curve
My Carrier: T-Mobile

Re: adding a menu item and launching the context menu and custom pop-up menu

Any idea when the release is coming?

TIA

Highlighted
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: adding a menu item and launching the context menu and custom pop-up menu

We're trying to line this release up with the RTM version of the PlayBook WebWorks SDK... Which should be in and around the PlayBook launch in mid April.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter