views:

57

answers:

2

hi all i'm going to make application on j2me Using canvas.... I want to take textbox or textfield on my canvas .. so plz tell me how to do this.

Thanks... Neel

A: 

These items are only available for adding to Forms. Canvas is a class for handling lower-level events.

You have to implement your own textbox, and that isn't easy.
Basic textbox would be a rectangle (drawRect) with text (drawString) inside of it.

BlaXpirit
A: 

You can draw a basic textbox and display a string , and when it receives focus, you can switch the view to that particular textbox ,something like this

textBox = new TextBox(....);
Midlet.display.setCurrent(textBox);

This would create your data entry more robust and save you from the pain of implementing various keyboard issues yourselves

Azlam
thanks Azlam for reply...but i'm using canvas ...so i need textbox...for user input...u r telling about form...
Neel
I am not telling about form, I am saying is draw a textbox using a rectangle, when that particular rectangle receives focus, switch from the canvas to the particular textbox (which is a Screen) and switch back to your canvas when done
Azlam