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
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Menu is not dismissed by pressing the back key

Hi there, 

 

With WebWorks 2.2, the menu is not dismissed by pressing the back key. That was not the behavior in WW 2.1.1. Is that by design, or is it an error? Is there any way to switch back to the old behavior? 

 

Thanks!

Please use plain text.
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Re: Menu is not dismissed by pressing the back key

Anyone there? I forgot to mention that this only happen once I install the onHardwareKey callback for the BACK key. As I previously remarked, with WebWorks 2.1.1, this didn't happen. 

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Menu is not dismissed by pressing the back key

Hi MLUY,

 

This sounds like a bug that may have been fixed with the ahrdware key fixes in the next branch. Are you willing to try patching your SDK? There are instructions here - https://github.com/blackberry/WebWorks/tree/next



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Re: Menu is not dismissed by pressing the back key

Thanks for your response.

 

I've already patched with that branch. Also, I've made a test with the unpatched WebWorks 2.2 SDK, and the bug is also present. 

Please use plain text.
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Re: Menu is not dismissed by pressing the back key

Should I file a bug somewhere? 

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Menu is not dismissed by pressing the back key

I'm just going to verify that it doesn't work for me with the patch and then we should log an issue in the WebWorks repo



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Menu is not dismissed by pressing the back key

Hi MLUY, 

 

I am able to dismiss a menu even with the 2.2 SDK with the following very simple widget

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,user-scalable=no,initial-scale=1.0">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <title> Back Menu Test </title>
</head>
    <script>
        function handleBack() {
            alert("handle back button");
        }
    </script>
</head>
<body>   
    <button onclick="blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK, handleBack);">Register</button>
    <button onclick="blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK);">Unregister</button>
</body>
</html>

 



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Re: Menu is not dismissed by pressing the back key

Hi, 

 

Your example works for me also. So, we have made further tests in order to get to the minimum example to reproduce this. 

 

We were able to reproduce the problem in a modified version of your example, whose only difference is that it adds a custom menu item. The code follows:

 

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,user-scalable=no,initial-scale=1.0">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <title> Back Menu Test </title>
</head>
    <script>
		function addmenu(){
			var a = logout_menuItem = new blackberry.ui.menu.MenuItem(false, blackberry.ui.menu.getMenuItems().length + 1, "a", handleMenu);
			var b = logout_menuItem = new blackberry.ui.menu.MenuItem(false, blackberry.ui.menu.getMenuItems().length + 2, "b", handleMenu);
			var c = logout_menuItem = new blackberry.ui.menu.MenuItem(false, blackberry.ui.menu.getMenuItems().length + 3, "c", handleMenu);
			blackberry.ui.menu.addMenuItem(a);
			blackberry.ui.menu.addMenuItem(b);
			blackberry.ui.menu.addMenuItem(c);
		}
		  function handleMenu() {
            alert("handle menu button");
        }
		
        function handleBack() {
            document.getElementById('input_text').value = "handle back button";
        }
    </script>
</head>
<body>   
<button onclick="addmenu();">Menu</button>
    <button onclick="blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK, handleBack);">Register</button>
    <button onclick="blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK);">Unregister</button>
	<input id="input_text" type="text" ></div>
</body>
</html>

 

Are you able to reproduce the problem with this one? 

Should I create a issue? 

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Menu is not dismissed by pressing the back key

Hi MLUY,

 

I am still unable to reproduce the issue on my phone, even with your code. Can you tell me the device/OS combination you're testing on (ie 9800/6.0.0.534)?



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Re: Menu is not dismissed by pressing the back key

Please make sure you press the button to register the custom menu item. It is only after that action that you'll be able to reproduce the problem.

 

Anyway, I'm testing with 9780 (real device)

Please use plain text.