Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6218
  • Last Modified:

J2ME... Setting Focus on a Text Field

Hopefully a really simple one today...  I have a form with a number of fields:

        timeForm = new Form("Time");
        timeinPSTField = new TextField("PST Time In or Minutes?", "", 4, TextField.NUMERIC);
        timeoutPSTField = new TextField("PST Time Out or 0?", "", 4, TextField.NUMERIC);
        timeinField = new TextField("EXEMPT Time In or Minutes?", "", 4, TextField.NUMERIC);
        timeoutField = new TextField("EXEMPT Time Out or blank?", "", 4, TextField.NUMERIC);
        timeForm.append(timeinPSTField);
        timeForm.append(timeoutPSTField);
        timeForm.append(timeinField);
        timeForm.append(timeoutField);
        timeForm.addCommand(okCommand);
        timeForm.addCommand(exitCommand);
        timeForm.setCommandListener(this);

How do I set the focus to a specific field...  Ie - Something like timeoutPSTField.setFocus().

Thanks in advance!

-Mike
0
NerdyMike
Asked:
NerdyMike
1 Solution
 
x4uCommented:
You can do it this way:

yourMidlet.getDisplay().setCurrentItem(timeoutPSTField);
0
 
NerdyMikeAuthor Commented:
So easy when you get the exact code!  I looked on Google for 45 minutes and couldn't easily find it!  (I found similar ones but not as precise as yours).


Thanks!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now