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
New Developer
Posts: 20
Registered: ‎05-07-2011
My Device: Bold
My Carrier: Rogers

AIR, GWT, and OnSwipeDown

I've developed an app using Google Web Toolkit, then re-packaged into a WebWorks application using bbwp.  My problem is the inconsistent behavior of the onswipedown call.  Actually, all this code is in the HTML file, and so GWT ought not to play a part in it, but I mention it for completeness.  Here is are some code fragments, based on an article by Adam Stanley:

 

 

<script type="text/javascript">
 function onSwipeDownCallback() {
 document.getElementById("menuBar").className = "showMenuBar";
 }
 function showMenuBar() {
 document.getElementById("menuBar").className = "showMenuBar";
 }
 function hideMenuBar() {
 document.getElementById("menuBar").className = "hideMenuBar";
 }
 function showAbout() {
 alert(blackberry.app.description + "\nBy " + blackberry.app.author
 + "\nVersion " + blackberry.app.version);
 }
 function setHandlers() {
 blackberry.app.event.onSwipeDown(onSwipeDownCallback);
 }
</script>

 

 

 

The function setHandlers is called onLoad, and it registers the onSwipeDownCallback to the onSwipeDown event.  When you swipe down, the class of the menuBar is changed to showMenuBar, and the CSS (not shown here) transitions the div so that it rolls down from the top.

 

Here's the weird part.  It works some of the time.

 

If it never worked, then I'd be happily debugging.  But some of the time??  It seems to either always work or never works.  In other words, when I start the app, and the menu refuses to appear on the swipe down, then it never appears.  I close the app, and restart it.  Fails again.  I close the app, and restart it.  It works!  And it will work every time I swipe down.  I close the app, and restart it.  Stops working.

 

Another weird clue.  I get the same behavior on the simulator.  Works or doesn't work.

 

Any clues?  Anyone ever have this sort of strangeness using blackberry.app.event?

 

Here is the code from the config.xml file that refers to the API:

 

 

<content src="Viewer.html" />

 

<feature id="blackberry.ui.dialog" />

<feature id="blackberry.app" />

<feature id="blackberry.app.event" />

 

<script type="text/javascript"> function onSwipeDownCallback() { document.getElementById("menuBar").className = "showMenuBar"; } function showMenuBar() { document.getElementById("menuBar").className = "showMenuBar"; } function hideMenuBar() { document.getElementById("menuBar").className = "hideMenuBar"; } function showAbout() { alert(blackberry.app.description + "\nBy " + blackberry.app.author + "\nVersion " + blackberry.app.version); } function setHandlers() { blackberry.app.event.onSwipeDown(onSwipeDownCallback); }</script>

New Developer
Posts: 31
Registered: ‎04-21-2011
My Device: Playbook
My Carrier: N/A

Re: AIR, GWT, and OnSwipeDown

Do you have a link to the original Adam Stanley article? I'm having a different GWT-based problem and I'd like to see the article you used before I ask questions of my own.

Thanks!
Highlighted
New Developer
Posts: 20
Registered: ‎05-07-2011
My Device: Bold
My Carrier: Rogers