This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alerting a TextField

 
Jaber Hass
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Is there any way of alerting a textField just like any ordinary alert??
i.e. showing it above a form without replacing the existing form.
[ March 07, 2005: Message edited by: Jaber Hass ]
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's not really any such thing as showing a screen above another screen, at leat not in MIDP. To do what you're asking, you have to do

Display.setCurrent(tb);

where tb is a TextBox. Then, set the CommandListener for tb to one that knows what the previous screen was, and will always return to that previous screen.

BUT, depending on what you're trying to do, I have another idea. If, say, you're trying to auto-display a textfield based on some user input in the form, then you can use, for example, an ItemStateListener or a CommandListener to append a TextField to your form on the fly.

For example, in my app, I have one form which queries a server and retrieves the last bulletin-board comment that was made about the user (as a StringItem). After the user reads the comment, they have the choice of clicking the "Back" command (which just exits that screen) or the "Respond" command, which causes a TextField to suddenly display in the same form.

In another example, I have a form with an EXCLUSIVE ChoiceGroup. If one particular item in that ChoiceGroup is selected, then the user is required to enter some more freeform text. So I attach an ItemStateListener to the ChoiceGroup, so that when that particular item is selected, a TextField is on-the-fly-added to the form.

Both approaches seem to work great.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic