BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 05-21-2009, 05:01 PM   #1 (permalink)
New Member
 
Join Date: Mar 2009
Model: 8900
PIN: N/A
Carrier: Rogers
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default capturing keyboard events on BB in javascript

Please Login to Remove!

Hi,

I am using a BB8900 with OS 4.6. I was wondering if it's possible to capture keyboard events from the blackberry browser via javascript on a webpage.
Please note that I only care about the browser that comes with OS 4.6 as all blackberries accessing the site will be running that version.

I've created a listener:

Code:
function processKeyPress()
{
   alert('good!');
}
Code:
document.addEventListener('keypress', processKeyPress, false);
I have a function processKeyPress() that will simply display an alert for now. However, this function never gets called. If I look at the same page in firefox, the keypress events are trapped as expected and this function is called.

The BB javascript documentation claims that the BB is supposed to be able to handle keyboard events but they never seem to be handled. It seems as though these keypresses are instead being trapped by the browser for use as keyboard shortcuts. For example, hitting 'd' will cause the browser to minimize. Is there anyway to have these keypresses processed by the page instead? Any tricks?

NOTE: The same thing if I attempt the following:
Code:
<body onkeypress="processKeyPress();">
So I guess the key here is whether or not it's possible for these key presses to get to the page instead of the browser intercepting them.

TIA.

Last edited by Dimentox : 05-21-2009 at 05:24 PM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Tektronix TM5006A Mainframe
$232.0
Tektronix TM5006A Mainframe pictureEXFO FTB-200 Main Frame W/ FTB-7400E-234B-EI-VFL OTDR 1310/1550/1625 nm (Sm)
$6999.99
EXFO FTB-200 Main Frame W/ FTB-7400E-234B-EI-VFL OTDR 1310/1550/1625 nm (Sm)  pictureHP 70001 SERIES MAIN FRAME SYSTEM, WITH PLUGINS 70310A(1), 70907B(2), 70900B(2)
$995.0
HP 70001 SERIES MAIN FRAME SYSTEM, WITH PLUGINS 70310A(1), 70907B(2), 70900B(2) pictureTEKTRONIX TM506 Mainframe with modules - DM501, DM502 & PS503A Power Supply
$149.99
TEKTRONIX TM506 Mainframe with modules - DM501, DM502 & PS503A Power Supply pictureTEKTRONIX TM 504 TM504 MAINFRAME / CHASSIS
$50.0
TEKTRONIX TM 504 TM504  MAINFRAME / CHASSIS picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.