Reputation: 1669
How to set onKeyEnter
event for EditField
. I have two EditField
in 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?
Upvotes: 0
Views: 952
Reputation: 313
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.
Upvotes: 0