Canvas direct text input (TextBox alternative)

Surprisingly little info on this on the net, so wonder if anyone can help:

Rather than opening a native javax.microedition.lcdui.TextBox, I want to be able to detect user input directly on a canvas (with the keyPressed() method).

I'm creating a generic MIDP2 midlet, and the main problem I'm going to face is detecting when the user has entered a space (as it could be possibly, the '0' key, the '#' key, the '*' key or the '1' key).

Is the best solution to just treat any of those key presses as a space, or is there a better way? Has anyone already got the code?

Cheers,

James

[625 byte] By [jhodgskia] at [2007-11-27 9:07:13]
# 1

James

I'm new here, but your post made me wonder... can't YOU be the boss and dictate to the user which key generates a space in your MIDlet?

As a newbie, I'm also interested to know: how would your MIDlet respond to the keypresses on a touch-screen keyboard (I have MotoROKR E6).

Shall look out for your response.

Regards, Darryl

Darryl.Burkea at 2007-7-12 21:43:42 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Hiya Darryl,

Yes, I could dicate which key generates the space, but they're going to have it printed on one of their phone's buttons, so I need to match up.

As for the other bit, sorry - I'm not up really up on touch screens. (If no-one gets back, and searching around fails, it might be worth posting a new topic.)

Cheers,

James

jhodgskia at 2007-7-12 21:43:42 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Thanks James

Your post inspired me to create my first canvas, haven't got around to text input yet, but made a color picker... maybe by next weekend I'll try text input but I don't think I'll be able to even activate the on-screen keyboard from the canvas... lets see.

I'll post only when I have a specific problem like yours, there are too many people (read: college kids trying to get their homework done for them) posting inane requests for help they could find with 2 minutes on Google.

Also it looks to me like there isn't any way you can identify the default space button/key, maybe this will be incorporated in a future spec.

Wish you luck, Darryl

Darryl.Burkea at 2007-7-12 21:43:42 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

> Also it looks to me like there isn't any way you can

> identify the default space button/key, maybe this

> will be incorporated in a future spec.

This is correct. The only solution for this is to detect the handset in use and map space to the correct button accordingly.

-Tobias

lund-melchera at 2007-7-12 21:43:42 > top of Java-index,Java Mobility Forums,Java ME Technologies...