How to Get Edit Box Focus?

How to Get Edit Box Focus? thumbnail
Many login controls are actually edit boxes.

The phrase "edit box" is a generic name used by programmers. It refers to a code that renders a rectangular object, allowing users to enter and submit data for processing. Almost anyone who has used a computer has used an edit box -- an example might include a box that allows you to enter you address before a program installs. Programmers use the term "focus" to refer to the currently selected program, which is the program that will display text when the user begins to type.

Instructions

    • 1

      Consult documentation used in your programming framework and find the method or function that allows you to manipulate focus.

    • 2

      Open the code page that contains the edit box.

    • 3

      Locate the portion of the code, called a "function," that triggers the appearance of the edit box, if the edit box is not permanently embedded into the interface. It may look like this:

      UserInterfacePage.GenerateControl("Sample Control Text");

    • 4

      Write the method that adds focus to the control in the line following the function call, or as soon as practical, like so:

      sampleWindow TextBox.ForceFocus();

    • 5

      Save your work and test it to ensure that a user who opens your program can immediately begin to type in the edit box. Open the program and begin to type without using the mouse to click on the box. Check to ensure that the text you typed appears in the edit box.

Tips & Warnings

  • Consult the documentation provided by your programming framework very carefully before moving automatic focus to an edit box, since this can compromise security in some frameworks.

Related Searches:

References

  • Photo Credit Hemera Technologies/Photos.com/Getty Images

Comments

Related Ads

Featured