views:

274

answers:

2

Hello,

I am developing a blackberry application using j2me and LWUIT (blackberry port). Everything works great except for the TextField in numeric mode. Basically when you have focus on the TextField you have to first go into "NUMERIC" mode (by pressing alt + aA) in order to input, which is not user friendly and a problem.

The proposed solution is to use a TextArea instead that allows you to open a NATIVE type input box. The problem there is that the user needs to focus the field and then press the fire button which again is unfriendly.

Does anyone know of any simple solutions?

The few solutions i have in mind (but not sure how to do them): 1) Capture any keypress on the TextArea and go into NATIVE mode, instead of just the fire key. 2) Put the blackberry input mode into numeric using code for the whole form.

Any advice will be appreciated.

Many Thanks,

Paul

+1  A: 

I'm not sure whether this solution is one that would appeal to your needs or not, but you could add j2me onKeyPress handling that "translates" the letter keypresses into the numbers that correspond to the same key and adds the "correct" number to the textfield instead of what the user actually pressed. Do keep in mind that such a solution would require you to worry portability issues as far as not all blackberry models using the same keyboard layout (qwerty vs. reduced qwerty for example) and handling the variation in layouts sufficiently.

Jessica
A: 

Okay well to answer my own question.

I overrided the keyRelease method on a TextArea. And in this method if the keypress is not an arrow key i the call editString method (this causes the native textfield to open). The only downside to this is that it will always miss the first keypress in the text box.

Paul