Skip to main content

Questions about TextField (Back Delete and chinese words input)

3 replies [Last post]
yt7589
Offline
Joined: 2008-05-06
Points: 0

Hi.

TextField is a very cool control which provide in place edit function. After playing with this control I have to questions:

The first one is how to delete the character user had input. The traditional back delete key seems has no effect at all.

The second question is about input chinese words. In my SonyEricsson phone if I press # key for a long time it will permit me to choose the input language then I can choose chinese words. But by using TextField the # key seems has no effect. I can only choose "ABC" "abc" "123". By reading the source code I found that in the TextField has the following code:
private static String defaultInputModeOrder[] = {
"Abc", "ABC", "abc", "123"
};

It seems that LWUIT TextField can only support English and digit input. How to add the function to allow the user input chinese words and other language then English?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi,
the text field by default only supports English input.

You can however add/modify the input modes for additional languages
using the API: addInputMode.
Due to the complexity of CJK (Chinese, Japanese & Korean) I doubt it
would be possible to create a suitable input mode but I'm far from
being an expert in these locales.

You can always enter the native input mode by pressing the T9 button.

Thanks,
Shai.

> Hi.
>
> TextField is a very cool control which provide in place edit
> function. After playing with this control I have to questions:
>
> The first one is how to delete the character user had input. The
> traditional back delete key seems has no effect at all.
>
> The second question is about input chinese words. In my
> SonyEricsson phone if I press # key for a long time it will permit
> me to choose the input language then I can choose chinese words.
> But by using TextField the # key seems has no effect. I can only
> choose "ABC" "abc" "123". By reading the source code I found that
> in the TextField has the following code:
> private static String defaultInputModeOrder[] = {
> "Abc", "ABC", "abc", "123"
> };
>
> It seems that LWUIT TextField can only support English and digit
> input. How to add the function to allow the user input chinese
> words and other language then English?
> [Message sent by forum member 'yt7589' (yt7589)]
>
> http://forums.java.net/jive/thread.jspa?messageID=283893
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

yt7589
Offline
Joined: 2008-05-06
Points: 0

Thanks for your quick reply!

I found the reason why clear and T9 menu item doesn't work for my application. I found that in the constructor of TextField class only the default constructor define the DELETE_COMMAND and T9_COMMAND as anonymous class. It add the event handler function. But the other two constructor only create the normal Command object. You had better check your source code to make sure all the constructor initialize DELETE_COMMAND and T9_COMMAND in the same way.

By the way I found that the javax.microedition.lcdui.TextField can provide the in place edit function also. It doesn't need to invoke T9 button and support chinese words input. Why not import that TextField to LWUIT? From the usibility point of view that one may be better.

Thanks!

Shai Almog

> Thanks for your quick reply!
>
> I found the reason why clear and T9 menu item doesn't work for my
> application. I found that in the constructor of TextField class
> only the default constructor define the DELETE_COMMAND and
> T9_COMMAND as anonymous class. It add the event handler function.
> But the other two constructor only create the normal Command
> object. You had better check your source code to make sure all the
> constructor initialize DELETE_COMMAND and T9_COMMAND in the same way.

Thats incorrect, all constructors in text field are chained and will
all create the commands.
Regardless the decompiler doesn't show the code properly since these
commands are initialized in place (which is the equivalent of copying
them to the root constructor).

> By the way I found that the javax.microedition.lcdui.TextField can
> provide the in place edit function also. It doesn't need to invoke
> T9 button and support chinese words input. Why not import that
> TextField to LWUIT? From the usibility point of view that one may
> be better.

Thats not technically possible, the MIDP component is a heavyweight
component and we need a lightweight implementation. If you want to
use the MIDP component you would have to use it with the entire MIDP
component widget set.

Thanks,
Shai.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net