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: 62
Registered: ‎07-29-2008
My Device: Not Specified

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;
    }
 

Developer
Posts: 19,633
Registered: ‎07-14-2008
My Device: Not Specified

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.

Highlighted
Developer
Posts: 62
Registered: ‎07-29-2008
My Device: Not Specified

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;
    }