0

How to detect key is released in Textfield ? I have tried by over-riding keyReleased(int code) but not working well . as shown in below :

TextField tf = new TextField(){

     public void keyReleased(int keyCode) {

                         }
                 };

Is there any idea?

Mun0n
  • 4,438
  • 4
  • 28
  • 46
Shyam Tha
  • 11
  • 1
  • 3

2 Answers2

1

So, if you want to capture this key in a non-touch device, take a look on this post:

LWUIT keyPressed

If it is for touch devices, you may use the pointerReleased(int x, int y). Override it and do what you want to do inside this method.

Community
  • 1
  • 1
Mun0n
  • 4,438
  • 4
  • 28
  • 46
1

Override it in form. You should probably also state the device since not all devices act alike. You might want to use the DataChangeListener if you just want to track changes to the text field.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • 1
    I have added the DAtaChangeListner to TextField and the problem is Only first character of keypad is passed even double/triple click on the same keypad. So I have over-ride on the keyReleased method on Textfield but unfortunately the problem is not solved. So how can I solve it? – Shyam Tha Nov 23 '12 at 10:54
  • There was a special case for the first key in text fields. I think we resolved it in Codename One. – Shai Almog Dec 12 '12 at 08:31