Wednesday, May 21, 2008

Text Input In LWUIT Now And In The Future

Chen and myself got a question during our LWUIT session in J1 which in retrospect we probably didn't answer correctly. Text input in LWUIT today goes to the system native text box and returns when the user approves the change to the text.

One of our biggest users asked us in the past for a "lightweight" text widget, this would allow fast input for numbers or search fields but won't support predicitive text (T9). Such a future development won't replace the option to go to the native text box but would supplant it mostly for the simpler input types (e.g. numbers) and for input types where T9 is less important (e.g. search where mostly names are typed).

So when we got a question of how input is implemented in LWUIT we made the mistake of discussing the future support for lightweight input rather than the already existing support for standard text box input.

BTW for lightweight numeric input we already have a sample in the developer guide which implements a numeric text field with a blinking cursor so this should be a feasible component.


  1. Hi Shai.
    I have started playing around with the lwuit and was a bit surprised to find no text input control. I understand it has been added. I downloaded the build from June and it had the textbox control.

    The issue I have is that when setting a text field in BorderLayout, if I use the Layout.CENTER option the height of the text box fills the entire space occupied by the centre border. How do I control the height of controls in a BorderLayout?



  2. Hi Shai,
    I'm trying to build a component which is combined a "TextField" with a List(Like the one in the Nokia's Contacts browser). the component must have the ability to browse between the names in the list by the up/down "arrows" key and by typing the name in the "Textfield" the name can have a various of letters, that the device supports.
    How I can be done?
    Eyal Muchtar.

  3. Hi Eyal, try opening a dialog with the correct dimensions where the input should appear.
    By not setting a title and disabling the background tint you can create the feeling of editing in place.