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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
redpath
Posts: 62
Registered: ‎07-29-2008

Custom Field capture keys

Is there something I am missing, I have a custom field and just want any keys given to it

when it has focus. I handle the navigation fine using the Nav methods of course.

 

    protected  boolean     keyUp(int keycode, int time) {
System.out.println("key code "+keycode);
        mykeyPressed(keycode);
        return true;
    }
 

Please use plain text.
Developer
peter_strange
Posts: 17,655
Registered: ‎07-14-2008

Re: Custom Field capture keys

I use keyChar to do this sort of thing.  However I think keys are delivered to the Screen before being delivered to the individual field - you can test that by coding a keyChar in you MainScreen and a keyChar in your Field, and see which gets control first.

Please use plain text.
Developer
redpath
Posts: 62
Registered: ‎07-29-2008

Re: Custom Field capture keys

Thanks this worked in the custom Field class I have

 

protected boolean keyChar(char character,
                          int status,
                          int time){
        keyPressed(character);
        return true;
    }

 

Please use plain text.