Forums Register Login

keyPressed() and TextBox

+Pie Number of slices to send: Send
is it possible that i could use keyPressed() to get the input and put the input in a textbox instead of painting it in the Canvas?
+Pie Number of slices to send: Send
This is not directly possible because of the way MIDP API is setup.
MIDP API is split into two parts - High-level API and Low-Level API.
High-Level API abstracts all the event handling details and gives you general methods. All classes under Screen fall under this category (hence TextBox)
Low-Level API is more open and lets you handle events. Classes under Canvas fall under this category.
Since TextBox is a High-Level API, you cannot access a low-level API.
Hope this helps.
+Pie Number of slices to send: Send
so i'm stuck with the drawChar() in Canvas is that so?
however you said directly my premise is not possible but how about indirectly? could i just call a method inside keyPressed() that would do the TextBox thing?
it is said (wrox Professional Java Mobile Programming ch5 p.176) we can mix a Canvas and a Screen in a single application.Just don't mix both high and low level in one single Screen. So the low level would be the keyPressed part and the high level would be the TextBox. i just don't know to go about it. Since Display.setCurrent would only accept 1 displayable.
+Pie Number of slices to send: Send
You could do something like drawing your own 'textbox' using your canvas' paint() method to do the drawing and then use the keyPressed() method to
to repaint the screen, adding or removing the appropriate characters from your 'textbox'.
Jason
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 910 times.
Similar Threads
javaScript Help......
Using onclick in input tag
Netscape - Input Boxes
KeyListener Issue
check number
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 01:03:13.