Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create a textfield in canvas

 
Bikesh maharjan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

can anybody tell me how to create a textfield in canvas??

thanks
 
Giovanni Lima
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I belive that isnt possible, because, textfield can only be attached in form component..
Look for JME documentation to figure out more details
 
Muzaffar Shah Khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes its not possible to use form and canvas components together ! According to me but there must be some other way out for it i guess.
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically, you can't create a textfield in a canvas, but I think you can create a textfield overlay on a canvas. By which I mean that the 2 controls (textfield and canvas) occupy the same part of the screen (layout manager permitting), but the Z order of the textfield puts it in front of the canvas.

Just be careful when implementing the paint code so that the canvas does, in fact render behind the text control!
 
Vijay Dogra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, You can create textfield using Canvas, though its quite lengthy and difficult

1. Override the paint method
2. Draw rectangle and use the font to be used to type
3. Override keypressed event and check which key is pressed and repaint it.

These are just guideliness.
 
Vijay Dogra
Greenhorn
Posts: 22
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic