1

Using Lwuit Version 1.5, Im having a problem using the Virtual Keyboard. Given a TextField with a Numeric constraint. The first character entered will go directly to the Textfield despite the constraint given.

I´ve found the sourceCode in actionCommand on VirtualKeyboard.java producing this issue;

case INSERT_CHAR:
            Button btn = currentButton;
            String text = btn.getText();
            if (inputField.getText().length() == 0) {
                inputField.setText(text);
                inputField.setCursorPosition(text.length());
            } else {
                inputField.insertChars(text);
            }
            break;

As seen above the first character will never go through insertChars and check for validity later.

Question is: I can't figure out why is this behavior implemented, Im afraid to break something I don't realize if I override that deleting the "if" part.

Anyone knows what the reason could be?

If anyone already have a Workarround for this issue please Id appreciate.

juanmazake
  • 11
  • 1
  • 1

1 Answers1

0

Its a known bug in LWUIT 1.5 that we fixed in Codename One, unfortunately no one is maintaining LWUIT anymore.

Your options are either to live with this issue, patch LWUIT, use TextArea (which is pretty different) or migrate to Codename One.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65