Microsoft KB Archive/124275

{| = How to Refresh an @...GET Field with a Single Keystroke =
 * width="100%"|

ID: Q124275

The information in this article applies to:


 * Microsoft FoxPro for Windows versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SUMMARY
This article shows by example how to erase incorrect data entered in an @...GET field quickly by pressing a single predefined key.

MORE INFORMATION
A screen that has one or more @...GET fields can serve the purpose of a data entry screen. Such screens may need a quick method for erasing erroneous data entered into any one of the input fields. In addition, users often want a quick way to delete information from an input field without having to use the Backspace key or drag a mouse pointer across the field.

The following procedure gives a method you can use to clear input field information quickly.

Step-by-Step Example
1. Create a screen containing two @...GET fields and an Exit button that

terminates the .SPR program. The Exit button is necessary because the ESC key will be used to execute an external program. However, you can use a key other than ESC. 2. Assign the variable name "m.getone" (without the quotation marks) to the first @...GET field, and assign the the variable name "m.gettwo" (without the quotation marks) to the second @...GET field. 3. Within the Setup Code of this screen, add the following command line: ON KEY LABEL esc DO WIPEOUT.PRG 4. Save the file as WIPEOUT.SCX. Then from the Command window, type: MODIFY COMMAND wipeout.prg 5. Enter the following code in WIPEOUT.PRG: fldname = VARREAD STORE " " TO (fldname) SHOW GET (fldname) RETURN 6. Save WIPEOUT.PRG. Then generate WIPEOUT.SPR from the WIPEOUT.SCX file. 7. From the Command window, type:

DO WIPEOUT.SPR

When the generated screen appears, enter random data into the first @...GET field. Then press the ESC key to generate the following events:

- Call WIPEOUT.PRG.

- Use VARREAD to assign to the 'fldname' variable the name of the @...GET field in which the cursor currently resides.

- Store a blank at the address where the 'fldname' variable resides.

- Show the new value that has been assigned to this address.

- Return, allowing the user to re-enter new data. 8. Press the TAB key to move to the second @...GET field. Notice that the same process can be executed within this input field as well. Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprg KBSubcategory: FxprgMacrosub
 * }