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
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

need to know what the button under thumbwheel is on 7130 for browser "back" function

Hi,

I'm trying to catch the browser  "back" action that seems to be implemented by the button under the trackwheel

on the right of the 7130. The code is hardcoded below but I have no idea what it is called. Thoughts?

The CONVENIENCE_KEY is only deffed after 4.2.x AFAIK and I need something for 4.x.. Thanks.

 

protected boolean keyDown(int keycode,
                          int time)
     {Dialog.alert("have 1769472?"+keycode);
    //  if (keycode==Keypad.KEY_ESCAPE )
      if (keycode==Keypad.KEY_ESCAPE )
       Dialog.alert("escape");
      if (keycode==Keypad.KEY_APPLICATION )
       Dialog.alert("application");
      if (keycode==Keypad.KEY_BACKLIGHT )
       Dialog.alert("backlight");
      if (keycode==1769472 )
      {//Dialog.alert("have escapew");
       if ( r_app.back_page() ) return true;  
      }
      
      return super.keyDown(keycode,time);
     }      

BlackBerry Development Advisor
MSohm
Posts: 14,752
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: need to know what the button under thumbwheel is on 7130 for browser "back" function

The button under the trackwheel is the escape key and should map to Keypad.KEY_ESCAPE (or Characters.ESCAPE if you are catching via keyChar).
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
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: need to know what the button under thumbwheel is on 7130 for browser "back" function

According to this code, Keypad.KEY_ESCAPE==27 ( which sounds like a character code). 

When I hit the escape button, the keycode is 1769472. What am I missing here? Do I need to convert

something? I tried looking through javadocs and developers guide and neither turned up anything. I think

I have seen some conversion methods and it appears I could just mask off the low byte or sometihng simple.

 

Thanks.

 

protected boolean keyDown(int keycode,
                          int time)
     {Dialog.alert("have 1769472?"+keycode);
    Dialog.alert("KEY_ESCAPE is"+Keypad.KEY_ESCAPE);
    //  if (keycode==Keypad.KEY_ESCAPE )
      if (keycode==Keypad.KEY_ESCAPE )
       Dialog.alert("escape found");
      /* if (keycode==Keypad.KEY_APPLICATION )
       Dialog.alert("application");
      if (keycode==Keypad.KEY_BACKLIGHT )
       Dialog.alert("backlight");
      */

BlackBerry Development Advisor
MSohm
Posts: 14,752
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: need to know what the button under thumbwheel is on 7130 for browser "back" function

You can't directly compare the value from the keyDown method to the value in the Keypad constants.  Instead, use the Keypad.key method (passing in the keycode from the keyDown method) and compare its return value to the constants.
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