How to set onKeyEnter event for editField in blackberry?

967 Views Asked by At

How to set onKeyEnter event for EditField. I have two EditFieldin my current screen. But i have to set event only one EditField .How can I set that?. I have Button field and list field in the same screen. I can able to set click even for both button and list.But problem is setting event for EditField.

I have used both key down and keychar method. But that not use to me. I checked with following method.

protected boolean keyChar(char key, int status, int time){

         if (key == Characters.ENTER){Dialog.alert("hi");}
        return false;
     } 
protected boolean keyChar(char character, int status, int time){

         if (Characters.ENTER == character){Dialog.alert("hi");}
        return false;
     }

If i am using like this I can't enter any character in both my editfield.

Can anyone help me?

1

There are 1 best solutions below

0
On

If i am using like this I can't enter any character in both my editfield.

You're eating all the keystrokes because you're not returning super.keyChar(key, status, time).

If you don't consume the key, you need to pass it on up.