BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-15-2007, 03:44 PM   #1 (permalink)
New Member
 
Join Date: Dec 2006
Model: 7100T
Carrier: Standard
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Keyevent handler in Blackberry

Please Login to Remove!

Hello Everybody,

Until now I developed Symbian OS in C++. So, I'm new in Blackberry. Which class I have to inherit to monitor the device keyevents?
I want to create an application, but I do not want to use the standard menu. I want to create custom menu using my keycodes.

Thank you in advance.
Best regrads,
Lorand
Offline  
Old 10-16-2007, 03:51 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

implement net.rim.device.api.system.KeyListener

here is an example that works like a numeric input filter extended with some extra:

Code:
    public boolean keyChar(char key, int status, int time) {
        boolean retval = false;
        Field field = getLeafFieldWithFocus();
if (field == numberField) {
switch(key) {
                case Characters.LATIN_SMALL_LETTER_W:
                    retval = true;
                    super.keyChar(Characters.DIGIT_ONE, 32768, 0);
                    break;
                case Characters.LATIN_SMALL_LETTER_E:
                    retval = true;
                    super.keyChar(Characters.DIGIT_TWO, 32768, 0);
                    break;
//more switches
default:
                if (!retval) super.keyChar(key, status, time);       
        }
       
        return retval;        
    }
__________________
java developer, Devinto, hamburg/germany
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





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