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
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

Re: onSwipeDown event exception when adding listener

Isn't there a special JQuery version that was created to avoid conflicts with other libraries?

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: onSwipeDown event exception when adding listener

Here is the html/js that I am using, all of it. This is just a barebones project but it still has the same issue as the other app I am trying to work with...

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	
    	<title>TestApp</title>
    	<script src="js/jquery-1.5.js" type="text/javascript"></script>
    	<script src="js/dock.js" type="text/javascript"></script>
	</head>
	
	<body onload="setHandlers();">
		<div id="menuBar" class="hideMenuBar">
			<ul id="menuBarLinks">
				<li onclick="doMenuAction('Action 1')"> Action 1 </li>
				<li onclick="doMenuAction('Action 2')"> Action 2 </li>
				<li onclick="doMenuAction('Action 3')"> Action 3 </li>
				<li onclick="doMenuAction('Action 4')"> Action 4 </li>
			</ul>
			<ul id="menuBarButton">
				<li onclick="doMenuAction('Help')"> Help </li>
				<li onclick="hideMenuBar()"> Close </li>
			</ul>
		</div>
	
		<div style="width:100%; height:100%;">
		<p><h1>Hello Test</h1></p>
		</div>
	</body>
</html>

 And the contents of dock.js

function showMenuBar()
{
	blackberry.ui.dialog.standardAskAsync(blackberry.ui.dialog.D_OK, "Change location?");
}
function hideMenuBar()
{
	$('#menuBar').toggleClass('hideMenuBar');
}	
function doMenuAction(msg)
{
	//Change the following alert() statement to whatever action you wish to invoke from the given menu item.
	alert(msg);
	hideMenuBar();
}		
function setHandlers()
{
	if ((typeof blackberry == "undefined") || (typeof blackberry.app == "undefined")) return false;
	
	//WebWorks API Reference guide:
	//	http://www.blackberry.com/developers/docs/webworks/api/playbook/
	//
	blackberry.app.event.onSwipeDown(showMenuBar);
}

 

Like all of my posts
Developer
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

Re: onSwipeDown event exception when adding listener

I don't think it's relevant, but your arguments don't match standardAskAsync's signature.

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: onSwipeDown event exception when adding listener

Good point, thats the standardAsk signature.
Like all of my posts
Retired
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: onSwipeDown event exception when adding listener

Modifying your code slightly I got both the JQuery and the dialog to work, I think it was the incorrect signatures holding you back. Attached is the working code.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <title>TestApp</title>
		<script src="jquery-1.5.js" type="text/javascript"></script>
        <script type="text/javascript">
	        function showMenuBar()
	        {
	            alert("Showing Menu Bar");
				$('#menuBar').show();
	        }
	        function hideMenuBar()
	        {
	            alert("Hiding Menu Bar");
				$('#menuBar').hide();
	        }   
	        function doMenuAction(msg)
	        {
	            //Change the following alert() statement to whatever action you wish to invoke from the given menu item.
	            blackberry.ui.dialog.standardAskAsync(msg, blackberry.ui.dialog.D_OK);
	            hideMenuBar();
	        }       
	        function setHandlers()
	        {
	            if ((typeof blackberry == "undefined") || (typeof blackberry.app == "undefined")) return false;
	            
	            //WebWorks API Reference guide:
	            //  http://www.blackberry.com/developers/docs/webworks/api/playbook/
	            //
	            blackberry.app.event.onSwipeDown(showMenuBar);
				$('#menuBar').hide();
	        }
        </script>
    </head>
    
    <body onload="setHandlers();">
        <div id="menuBar" class="hideMenuBar">
            <ul id="menuBarLinks">
                <li onclick="doMenuAction('Action 1')"> Action 1 </li>
                <li onclick="doMenuAction('Action 2')"> Action 2 </li>
                <li onclick="doMenuAction('Action 3')"> Action 3 </li>
                <li onclick="doMenuAction('Action 4')"> Action 4 </li>
            </ul>
            <ul id="menuBarButton">
                <li onclick="doMenuAction('Help')"> Help </li>
                <li onclick="hideMenuBar()"> Close </li>
            </ul>
        </div>
    
        <div style="width:100%; height:100%;">
        <p><h1>Hello Test</h1></p>
        </div>
    </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)