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

Java Development

Reply
Developer
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified
Accepted Solution

BrowserContentManager key capture

Hi all,

 

we've added the BrowserContentManager as per the example given by RIM to our application. Everything seems to work fine, but certian keys have lost there function. For example, before we added the BrowserContentManager the space key (if held down four seconds) on an 8830 would trigger a function.

 

The debugger doesn't even seem to acknowledge that space was pressed. I assume this is because the space event is being passed to the browser field and not the screen (where space is captured). Should i just move the keyChar overriden method to the class implementing the browser? Is there a better way to get around this?

 

Cheers,

Chris.

BlackBerry Development Advisor
Posts: 15,016
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: BrowserContentManager key capture

The BrowserField itself could be capturing the key strokes.  You can add a KeyListener to the screen to capture keys it is not consuming.  Note that the browser field uses many of the same key shortcuts that the BlackBerry Browser uses.  Overriding these may impact the browsing experience for your users.  I recommend moving your function triggers to MenuItems accessible from the screen's menu instead.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified

Re: BrowserContentManager key capture

Thanks for that advice, I will try KeyListener.

 

Am I right in saying that KeyListener is not 'passive'? By that i mean it consumes key events, so anything over written in KeyListeners keyChar would no also be passed on to the browserField object?

 

Cheers,

Chris.

BlackBerry Development Advisor
Posts: 15,016
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: BrowserContentManager key capture

This depends on whether you return true or false in the keyChar method.  True means the key was consumed, false means it was not and that it should be passed to the next level.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified

Re: BrowserContentManager key capture

That worked, thanks Mark.