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: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: BlackBerry softkeys.

I don't understand what you mean "95 does not respond to a keypressed event".

 

Also, 0x95 (hex) is actually 149 in decimal notation - sorry for the hexadecimal (took it straight out of some code).

 

 

 

Developer
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: BlackBerry softkeys.

I'm sorry for the missunderstanding,

normally in a midlet  (not in the BB world) we have a method that we use

to listen for command like FIRE, SOFTKEYS,  BUTTON PRESSED...

 

something like that:

protected void keyPressed(int kc) {
        if (getGameAction(kc) == DOWN || getGameAction(kc) == RIGHT || kc == -7) {
             do something here...

}

}

 

is there some keycode that I can use for BlackBerry to listen for menu button pressed?

149 does not work on my 8120/8900 emulator.

thanks!

Highlighted
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: BlackBerry softkeys.

Hi,

 

I think you can use net.rim.device.api.system.KeyListener Interface it contains 5 methods which will provide you key code for every key and every event which happens through keypad.

 

 

Please let me know that this solved your problem or not

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: BlackBerry softkeys.

can you give me a code sample?

 

I've got this:

protected void keyPressed(int kc) {
        if (getGameAction(kc) == DOWN || getGameAction(kc) == RIGHT || kc == -7) {
             do something here...

}

}

 

How can I do something in my canvas after I press the menubutton?

 

Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: BlackBerry softkeys.

To get the key code, why don't you just print out to the console all of the key presses you get, before you check them?  Then you can push the menu key within your application and see what you'll need to catch later on.
Andrew Cowart | Metova
www.metova.com
Developer
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: BlackBerry softkeys.

no keycode is caputered if I press the menu button
Developer
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: BlackBerry softkeys.

no one use menu button in his canvas?

no one could post a code sample that trap the press menu button and then repaint();

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: BlackBerry softkeys.

protected boolean keyDown(int keycode, int time) { if (Keypad.key(keycode) == Keypad.KEY_MENU) { System.out.println("Calling invalidate() here"); return true; } else return false; } protected void makeMenu(Menu menu, int instance) { System.out.println("Override Make menu"); }

 


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: BlackBerry softkeys.

doesn not work on 8120/8900 emulator.
Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: BlackBerry softkeys.

Sblantipodi,

 

In your posts, I've seen you reference that you're making Midlets.

 

Are you using a canvas?   The methods for canvas are keyPressed, keyReleased, and keyRepeated - not keyDown.

Andrew Cowart | Metova
www.metova.com