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
Contributor
ogiprayogo
Posts: 24
Registered: ‎02-10-2010
My Device: 9550
Accepted Solution

keyCharUnhandled & BlackBerry menu button

[ Edited ]

Hi,

 

I am trying to override the default function of Keypad.ESCAPE, and i use the following code:

 

 

protected boolean keyCharUnhandled(char c, int status, int time) {
	switch (c) {
	case Keypad.KEY_ESCAPE:
		System.out.println("Escape button pressed");
                // do something here, and then exit.
System.exit(0); return true; default: return false; } }

This method is in a class that extends MainSreen. I had to overide keyCharUnhandled because there is a edit field in the main screen, and if I override keyChar in the class, then the keyChar on the editfield won't be called (or at least thats what i thought what happened)

 

The problem is, when I use this approach (overriden keyCharUnhandled) it seems it cannot detect the BlackBerry menu button. How do I fix this?

 

 

OPrayogo
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: keyCharUnhandled & BlackBerry menu button

you can override keychar safely if you call super instead of returning false

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
ogiprayogo
Posts: 24
Registered: ‎02-10-2010
My Device: 9550

Re: keyCharUnhandled & BlackBerry menu button

You know what, as soon as I hit the "Post" button, the same thought occured in my mind. :smileyvery-happy:

 

My bad, thanks for your reply.  :smileyhappy:

OPrayogo